补充pure用户头像上传功能
This commit is contained in:
@@ -3,5 +3,6 @@
|
||||
public class UpdateIconDto
|
||||
{
|
||||
public string? Icon { get; set; }
|
||||
public Guid? UserId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user