fix: 修复审计日志判断当前用户为空的问题

This commit is contained in:
陈淳
2024-01-31 18:16:17 +08:00
parent c50f1ffcb4
commit ff19cb68b9
6 changed files with 110 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
using Volo.Abp.DependencyInjection;
using Volo.Abp;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Bbs.Domain.Shared.Consts;
using Yi.Framework.Bbs.Domain.Shared.Etos;
using Yi.Framework.SqlSugarCore.Abstractions;
@@ -15,6 +17,13 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
}
public async Task HandleEventAsync(MoneyChangeEventArgs eventData)
{
var userIfno = await _userInfoRepository.GetFirstAsync(x => x.UserId == eventData.UserId);
//如果变化后的钱钱少于0直接丢出去
if ((userIfno.Money + eventData.Number)<0)
{
throw new UserFriendlyException(MoneyConst.Money_Low_Zero);
}
//原子性sql
await _userInfoRepository._Db.Updateable<BbsUserExtraInfoEntity>()
.SetColumns(it => it.Money == it.Money + eventData.Number)