认证类型

This commit is contained in:
马梓彭 2026-06-16 11:44:38 +08:00
parent e3499ef5c3
commit 2d3fa6e09d
2 changed files with 28 additions and 6 deletions

View File

@ -310,7 +310,6 @@ public class AppUserService : BaseService<AppUserEntity>, ITransient
entity.Name = input.Name; entity.Name = input.Name;
entity.Gender = input.Gender; entity.Gender = input.Gender;
entity.IdCardNumber = input.IdCardNumber; entity.IdCardNumber = input.IdCardNumber;
entity.AuthType = input.AuthType;
entity.Mobile = input.Mobile; entity.Mobile = input.Mobile;
entity.Remark = input.Remark; entity.Remark = input.Remark;
entity.AuditRemark = isUnitTransfer ? "单位更换" : ""; entity.AuditRemark = isUnitTransfer ? "单位更换" : "";
@ -318,8 +317,17 @@ public class AppUserService : BaseService<AppUserEntity>, ITransient
entity.Age = input.Age; entity.Age = input.Age;
// 根据认证类型把图片URL写入对应字段,并清空其他类型图片 // 根据认证类型把图片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.PassportPhotoUrl = input.PassportPhotoUrl ?? input.IdCardImageUrl;
entity.IdCardImageUrl = null; entity.IdCardImageUrl = null;
entity.IdCardBackImageUrl = null; entity.IdCardBackImageUrl = null;
@ -327,6 +335,7 @@ public class AppUserService : BaseService<AppUserEntity>, ITransient
} }
else if (input.AuthType == 3) else if (input.AuthType == 3)
{ {
entity.AuthType = 3;
entity.HouseholdPhotoUrl = input.HouseholdPhotoUrl ?? input.IdCardImageUrl; entity.HouseholdPhotoUrl = input.HouseholdPhotoUrl ?? input.IdCardImageUrl;
entity.IdCardImageUrl = null; entity.IdCardImageUrl = null;
entity.IdCardBackImageUrl = null; entity.IdCardBackImageUrl = null;
@ -334,8 +343,11 @@ public class AppUserService : BaseService<AppUserEntity>, ITransient
} }
else else
{ {
entity.IdCardImageUrl = input.IdCardImageUrl; // AuthType == 0 或其他值:未认证,不修改认证相关字段(保持原样)
entity.IdCardBackImageUrl = input.IdCardBackImageUrl; // 但清空可能的残留图片URL,避免脏数据
entity.AuthType = 0;
entity.IdCardImageUrl = null;
entity.IdCardBackImageUrl = null;
entity.PassportPhotoUrl = null; entity.PassportPhotoUrl = null;
entity.HouseholdPhotoUrl = null; entity.HouseholdPhotoUrl = null;
} }

View File

@ -186,7 +186,7 @@ public class MyController : IDynamicApiController
} }
else else
{ {
throw Oops.Bah("不支持的认证类型"); throw Oops.Bah("请选择认证类型");
} }
if (string.IsNullOrEmpty(input.SmsCode)) 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.Gender = (Gender)input.Gender.Value;
user.BirthDate = input.BirthDate.Value; user.BirthDate = input.BirthDate.Value;
} }
else else if (input.AuthType == 3)
{ {
// AuthType == 3:户口本认证 // AuthType == 3:户口本认证
user.IdCardNumber = input.IdCardNumber; user.IdCardNumber = input.IdCardNumber;
@ -256,6 +256,16 @@ public class MyController : IDynamicApiController
user.BirthDate = input.BirthDate.Value; 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.AuditStatus = AuditStatus.PendingAudit;
user.UpdatedTime = DateTime.Now; user.UpdatedTime = DateTime.Now;