diff --git a/YD_Event.Application/Client/Dtos/MyDtos.cs b/YD_Event.Application/Client/Dtos/MyDtos.cs index 2c4d568..ef0a8c8 100644 --- a/YD_Event.Application/Client/Dtos/MyDtos.cs +++ b/YD_Event.Application/Client/Dtos/MyDtos.cs @@ -601,6 +601,19 @@ public class MyRegistrationDto public string ProjectNames { get; set; } } +/// +/// 更新头像URL输入 +/// +public class UpdateAvatarUrlInput +{ + /// + /// 头像图片URL + /// + [Required(ErrorMessage = "头像URL不能为空")] + [MaxLength(500, ErrorMessage = "头像URL不能超过500个字符")] + public string AvatarUrl { get; set; } = string.Empty; +} + /// /// 更新头像输出 /// diff --git a/YD_Event.Application/Client/MyController.cs b/YD_Event.Application/Client/MyController.cs index 1245397..1c91865 100644 --- a/YD_Event.Application/Client/MyController.cs +++ b/YD_Event.Application/Client/MyController.cs @@ -721,19 +721,14 @@ public class MyController : IDynamicApiController /// /// 更新头像 - 使用图片URL /// - /// 头像图片URL + /// 头像URL输入 /// 更新后的头像信息 [HttpPost("avatar/url")] [DisplayName("更新头像URL")] - public async Task UpdateAvatarByUrl([FromBody] string avatarUrl) + public async Task UpdateAvatarByUrl([FromBody] UpdateAvatarUrlInput input) { - if (string.IsNullOrWhiteSpace(avatarUrl)) - { - throw Oops.Bah("头像URL不能为空"); - } - // 验证URL格式 - if (!Uri.TryCreate(avatarUrl, UriKind.Absolute, out _)) + if (!Uri.TryCreate(input.AvatarUrl, UriKind.Absolute, out _)) { throw Oops.Bah("头像URL格式不正确"); } @@ -746,13 +741,13 @@ public class MyController : IDynamicApiController throw Oops.Bah("用户信息不存在"); } - user.Avatar = avatarUrl; + user.Avatar = input.AvatarUrl; user.UpdatedTime = DateTime.Now; await _appUserRepository.UpdateAsync(user); return new UpdateAvatarOutput { - AvatarUrl = avatarUrl + AvatarUrl = input.AvatarUrl }; } diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml index 380b51f..2a507fc 100644 --- a/YD_Event.Application/YD_Event.Application.xml +++ b/YD_Event.Application/YD_Event.Application.xml @@ -3482,6 +3482,16 @@ 报名项目集合 + + + 更新头像URL输入 + + + + + 头像图片URL + + 更新头像输出 @@ -3810,11 +3820,11 @@ 头像图片文件 更新后的头像信息 - + 更新头像 - 使用图片URL - 头像图片URL + 头像URL输入 更新后的头像信息