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,49 @@
using Volo.Abp.Domain.Services;
using Volo.Abp.EventBus.Local;
using Yi.Framework.Bbs.Domain.Entities.Integral;
using Yi.Framework.Bbs.Domain.Shared.Etos;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Domain.Managers
{
public class IntegralManager : DomainService
{
private ISqlSugarRepository<LevelEntity> _levelRepository;
private ISqlSugarRepository<SignInEntity> _signInRepository;
private readonly ILocalEventBus _localEventBus;
public IntegralManager(ISqlSugarRepository<LevelEntity> levelRepository, ISqlSugarRepository<SignInEntity> signInRepository, ILocalEventBus localEventBus)
{
_levelRepository = levelRepository;
_localEventBus = localEventBus;
_signInRepository = signInRepository;
}
/// <summary>
/// 签到
/// </summary>
/// <returns></returns>
public async Task PostSignInAsync(Guid userId)
{
//签到,添加用户钱钱
//发送一个充值的领域事件即可
//签到添加的钱钱,跟连续签到有关系
//每天随机3-10连续签到每次累加多1点最多一天30
//额外
//如果随机数数字都相同额外再获取乘10倍
//这种逻辑,就是属于核心领域业务了
decimal number = 3;
//发布一个其他领域的事件
await _localEventBus.PublishAsync(new MoneyChangeEventArgs() { UserId = userId, Number = number });
}
}
}