feat: 完善,调整矿物刷新

This commit is contained in:
橙子
2024-10-28 22:40:23 +08:00
parent 363be13d12
commit a47d271a33
5 changed files with 85 additions and 27 deletions

View File

@@ -15,12 +15,13 @@ public class SuccessMiningEventHandler : ILocalEventHandler<SuccessMiningEto>, I
{
private MiningPoolManager _miningPoolManager;
private ISqlSugarRepository<CollectiblesAggregateRoot> _repository;
private readonly ISqlSugarRepository<CollectiblesUserStoreAggregateRoot> _userStoreRepository;
public SuccessMiningEventHandler(MiningPoolManager miningPoolManager,
ISqlSugarRepository<CollectiblesAggregateRoot> repository)
ISqlSugarRepository<CollectiblesAggregateRoot> repository, ISqlSugarRepository<CollectiblesUserStoreAggregateRoot> userStoreRepository)
{
_miningPoolManager = miningPoolManager;
_repository = repository;
_userStoreRepository = userStoreRepository;
}
public async Task HandleEventAsync(SuccessMiningEto eventData)
@@ -32,5 +33,13 @@ public class SuccessMiningEventHandler : ILocalEventHandler<SuccessMiningEto>, I
//新增全世界发现
currentCollectibles.FindTotal += 1;
await _repository.UpdateAsync(currentCollectibles);
//使用结果新增给对应的用户
await _userStoreRepository.InsertAsync(new CollectiblesUserStoreAggregateRoot
{
UserId = eventData.UserId,
CollectiblesId = eventData.CollectiblesId,
IsRead = false
});
}
}