From 2d3fa6e09d3e15913f83ef5faa167f95f62269ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Tue, 16 Jun 2026 11:44:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppUser/AppUserService.cs | 20 +++++++++++++++---- YD_Event.Application/Client/MyController.cs | 14 +++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/YD_Event.Application/AppUser/AppUserService.cs b/YD_Event.Application/AppUser/AppUserService.cs index f3981e6..4c23b7b 100644 --- a/YD_Event.Application/AppUser/AppUserService.cs +++ b/YD_Event.Application/AppUser/AppUserService.cs @@ -310,7 +310,6 @@ public class AppUserService : BaseService, ITransient entity.Name = input.Name; entity.Gender = input.Gender; entity.IdCardNumber = input.IdCardNumber; - entity.AuthType = input.AuthType; entity.Mobile = input.Mobile; entity.Remark = input.Remark; entity.AuditRemark = isUnitTransfer ? "单位更换" : ""; @@ -318,8 +317,17 @@ public class AppUserService : BaseService, ITransient entity.Age = input.Age; // 根据认证类型把图片URL写入对应字段,并清空其他类型图片 - if (input.AuthType == 2) + if (input.AuthType == 1) { + entity.AuthType = 1; + entity.IdCardImageUrl = input.IdCardImageUrl; + entity.IdCardBackImageUrl = input.IdCardBackImageUrl; + entity.PassportPhotoUrl = null; + entity.HouseholdPhotoUrl = null; + } + else if (input.AuthType == 2) + { + entity.AuthType = 2; entity.PassportPhotoUrl = input.PassportPhotoUrl ?? input.IdCardImageUrl; entity.IdCardImageUrl = null; entity.IdCardBackImageUrl = null; @@ -327,6 +335,7 @@ public class AppUserService : BaseService, ITransient } else if (input.AuthType == 3) { + entity.AuthType = 3; entity.HouseholdPhotoUrl = input.HouseholdPhotoUrl ?? input.IdCardImageUrl; entity.IdCardImageUrl = null; entity.IdCardBackImageUrl = null; @@ -334,8 +343,11 @@ public class AppUserService : BaseService, ITransient } else { - entity.IdCardImageUrl = input.IdCardImageUrl; - entity.IdCardBackImageUrl = input.IdCardBackImageUrl; + // AuthType == 0 或其他值:未认证,不修改认证相关字段(保持原样) + // 但清空可能的残留图片URL,避免脏数据 + entity.AuthType = 0; + entity.IdCardImageUrl = null; + entity.IdCardBackImageUrl = null; entity.PassportPhotoUrl = null; entity.HouseholdPhotoUrl = null; } diff --git a/YD_Event.Application/Client/MyController.cs b/YD_Event.Application/Client/MyController.cs index 3b488d0..5503e62 100644 --- a/YD_Event.Application/Client/MyController.cs +++ b/YD_Event.Application/Client/MyController.cs @@ -186,7 +186,7 @@ public class MyController : IDynamicApiController } else { - throw Oops.Bah("不支持的认证类型"); + throw Oops.Bah("请选择认证类型"); } if (string.IsNullOrEmpty(input.SmsCode)) throw Oops.Bah("手机号验证码不能为空"); @@ -239,7 +239,7 @@ public class MyController : IDynamicApiController user.Gender = (Gender)input.Gender.Value; user.BirthDate = input.BirthDate.Value; } - else + else if (input.AuthType == 3) { // AuthType == 3:户口本认证 user.IdCardNumber = input.IdCardNumber; @@ -256,6 +256,16 @@ public class MyController : IDynamicApiController user.BirthDate = input.BirthDate.Value; } } + else + { + // AuthType == 0 或其他值:未认证,不修改任何认证相关字段 + user.AuthType = 0; + user.IdCardNumber = null; + user.IdCardImageUrl = null; + user.IdCardBackImageUrl = null; + user.PassportPhotoUrl = null; + user.HouseholdPhotoUrl = null; + } user.AuditStatus = AuditStatus.PendingAudit; user.UpdatedTime = DateTime.Now;