diff --git a/YD_Event.Application/AppUser/AppUserService.cs b/YD_Event.Application/AppUser/AppUserService.cs index d1e5bb9..995588f 100644 --- a/YD_Event.Application/AppUser/AppUserService.cs +++ b/YD_Event.Application/AppUser/AppUserService.cs @@ -51,7 +51,36 @@ public class AppUserService : BaseService, ITransient .WhereIF(input.EndTime.HasValue, u => u.CreatedTime <= input.EndTime) .OrderByDescending(u => u.CreatedTime); - return await query.Select().ToPagedListAsync(input); + var result = await query.Select().ToPagedListAsync(input); + + // 根据认证类型填充统一的 CertImageUrl 和 CertNumber 字段 + foreach (var item in result.Rows) + { + FillCertFields(item); + } + + return result; + } + + /// + /// 根据认证类型填充统一的认证证件字段(CertImageUrl, CertNumber) + /// + private static void FillCertFields(AppUserOutput output) + { + output.CertImageUrl = output.AuthType switch + { + 1 => output.IdCardImageUrl, + 2 => output.PassportPhotoUrl, + 3 => output.HouseholdPhotoUrl, + _ => output.IdCardImageUrl ?? output.HouseholdPhotoUrl ?? output.PassportPhotoUrl + }; + + output.CertNumber = output.AuthType switch + { + 1 or 3 => output.IdCardNumber, + 2 => output.PassportNumber, + _ => output.IdCardNumber ?? output.PassportNumber + }; } /// @@ -63,10 +92,15 @@ public class AppUserService : BaseService, ITransient [HttpGet("{id}")] public async Task Detail([FromRoute] long id) { - return await _appUserRep.AsQueryable() + var output = await _appUserRep.AsQueryable() .Where(u => u.Id == id) .Select() .FirstAsync(); + + // 根据认证类型填充统一的 CertImageUrl 和 CertNumber 字段 + FillCertFields(output); + + return output; } /// diff --git a/YD_Event.Application/AppUser/Dtos/AppUserDtos.cs b/YD_Event.Application/AppUser/Dtos/AppUserDtos.cs index 3aa838e..bc05039 100644 --- a/YD_Event.Application/AppUser/Dtos/AppUserDtos.cs +++ b/YD_Event.Application/AppUser/Dtos/AppUserDtos.cs @@ -313,10 +313,23 @@ public class AppUserOutput public string? HouseholdPhotoUrl { get; set; } /// - /// 认证类型:1-身份证,2-护照,3-户口本 + /// 认证类型:0-未认证,1-身份证,2-护照,3-户口本 /// public int AuthType { get; set; } + /// + /// 认证证件图片URL(根据AuthType返回对应证件的图片URL) + /// AuthType=1 → IdCardImageUrl + /// AuthType=2 → PassportPhotoUrl + /// AuthType=3 → HouseholdPhotoUrl + /// + public string? CertImageUrl { get; set; } + + /// + /// 证件号码(根据AuthType返回:身份证号或护照号) + /// + public string? CertNumber { get; set; } + /// /// 审核状态 ///