!49 pure补充头像上传逻辑

Merge pull request !49 from tyjctl/abp
This commit is contained in:
橙子
2024-10-07 07:02:36 +00:00
committed by Gitee
5 changed files with 42 additions and 15 deletions

View File

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

View File

@@ -1,4 +1,4 @@
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using Lazy.Captcha.Core;
using Mapster;
using Microsoft.AspNetCore.Authorization;
@@ -427,7 +427,10 @@ namespace Yi.Framework.Rbac.Application.Services
/// <returns></returns>
public async Task<bool> UpdateIconAsync(UpdateIconDto input)
{
var entity = await _userRepository.GetByIdAsync(_currentUser.Id);
Guid userId=input.UserId == null?_currentUser.GetId():input.UserId.Value;
var entity = await _userRepository.GetByIdAsync(userId);
if (entity.Icon == input.Icon)
{
return false;
@@ -438,7 +441,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;
}
}