补充pure用户头像上传功能

This commit is contained in:
tyjctl
2024-09-24 14:44:06 +08:00
parent 38e112fb06
commit 8e66a9880c
5 changed files with 50 additions and 14 deletions

View File

@@ -3,5 +3,6 @@
public class UpdateIconDto
{
public string? Icon { get; set; }
public Guid? UserId { get; set; }
}
}

View File

@@ -379,7 +379,19 @@ namespace Yi.Framework.Rbac.Application.Services
/// <returns></returns>
public async Task<bool> UpdateIconAsync(UpdateIconDto input)
{
var entity = await _userRepository.GetByIdAsync(_currentUser.Id);
Guid userId;
if (input.UserId == null)
{
userId = _currentUser.GetId();
}
else
{
userId = input.UserId.Value;
}
var entity = await _userRepository.GetByIdAsync(userId);
if (entity.Icon == input.Icon)
{
return false;
@@ -390,7 +402,7 @@ namespace Yi.Framework.Rbac.Application.Services
//发布更新头像任务事件
await this.LocalEventBus.PublishAsync(
new AssignmentEventArgs(AssignmentRequirementTypeEnum.UpdateIcon, _currentUser.GetId()), false);
new AssignmentEventArgs(AssignmentRequirementTypeEnum.UpdateIcon, userId), false);
return true;
}
}