feat: bbs完善钱钱实时变化
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.EventBus;
|
||||
using Volo.Abp.EventBus.Local;
|
||||
using Yi.Framework.Bbs.Domain.Entities;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Consts;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Enums;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Etos;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
@@ -11,9 +13,11 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
|
||||
public class MoneyChangeEventHandler : ILocalEventHandler<MoneyChangeEventArgs>, ITransientDependency
|
||||
{
|
||||
private ISqlSugarRepository<BbsUserExtraInfoEntity> _userInfoRepository;
|
||||
public MoneyChangeEventHandler(ISqlSugarRepository<BbsUserExtraInfoEntity> userInfoRepository)
|
||||
private ILocalEventBus _localEventBus;
|
||||
public MoneyChangeEventHandler(ISqlSugarRepository<BbsUserExtraInfoEntity> userInfoRepository, ILocalEventBus localEventBus)
|
||||
{
|
||||
_userInfoRepository = userInfoRepository;
|
||||
_localEventBus = localEventBus;
|
||||
}
|
||||
public async Task HandleEventAsync(MoneyChangeEventArgs eventData)
|
||||
{
|
||||
@@ -28,6 +32,9 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
|
||||
await _userInfoRepository._Db.Updateable<BbsUserExtraInfoEntity>()
|
||||
.SetColumns(it => it.Money == it.Money + eventData.Number)
|
||||
.Where(x => x.UserId == eventData.UserId).ExecuteCommandAsync();
|
||||
|
||||
|
||||
await _localEventBus.PublishAsync(new BbsNoticeEventArgs(NoticeTypeEnum.Money, eventData.UserId,eventData.Number.ToString()), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user