feat:搭建积分领域

This commit is contained in:
陈淳
2024-01-11 18:51:53 +08:00
parent 3ee8419802
commit 5a65a2e49f
46 changed files with 466 additions and 80 deletions

View File

@@ -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();
}
}
}

View File

@@ -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
{

View File

@@ -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);
}