feat:搭建积分领域
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.EventBus;
|
||||
using Yi.Framework.Bbs.Domain.Entities;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Etos;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Bbs.Application.EventHandlers
|
||||
{
|
||||
public class MoneyChangeEventHandler : ILocalEventHandler<MoneyChangeEventArgs>, ITransientDependency
|
||||
{
|
||||
private ISqlSugarRepository<BbsUserExtraInfoEntity> _userInfoRepository;
|
||||
public MoneyChangeEventHandler(ISqlSugarRepository<BbsUserExtraInfoEntity> userInfoRepository)
|
||||
{
|
||||
_userInfoRepository = userInfoRepository;
|
||||
}
|
||||
public async Task HandleEventAsync(MoneyChangeEventArgs eventData)
|
||||
{
|
||||
//原子性sql
|
||||
await _userInfoRepository._Db.Updateable<BbsUserExtraInfoEntity>()
|
||||
.SetColumns(it => it.Money == it.Money + eventData.Number)
|
||||
.Where(x => x.UserId == eventData.UserId).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ using System.Threading.Tasks;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Volo.Abp.EventBus;
|
||||
using Yi.Framework.Bbs.Domain.Entities;
|
||||
using Yi.Framework.Bbs.Domain.Entities.Forum;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Etos;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.EventHandlers
|
||||
namespace Yi.Framework.Bbs.Application.EventHandlers
|
||||
{
|
||||
public class SeeDiscussEventHandler : ILocalEventHandler<SeeDiscussEventArgs>, ITransientDependency
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using Yi.Framework.Bbs.Domain.Entities;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Enums;
|
||||
using Yi.Framework.Rbac.Domain.Shared.Etos;
|
||||
|
||||
namespace Yi.Framework.Rbac.Application.EventHandlers
|
||||
namespace Yi.Framework.Bbs.Application.EventHandlers
|
||||
{
|
||||
public class UserCreateEventHandler : ILocalEventHandler<UserCreateEventArgs>, ITransientDependency
|
||||
{
|
||||
@@ -19,7 +19,7 @@ namespace Yi.Framework.Rbac.Application.EventHandlers
|
||||
//创建主表
|
||||
var bbsUser = new BbsUserExtraInfoEntity(eventData.UserId)
|
||||
{
|
||||
|
||||
|
||||
};
|
||||
await _repository.InsertAsync(bbsUser);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user