Files
Yi.Framework/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SetAccountInfoEventHandler.cs
2024-11-03 15:49:41 +08:00

29 lines
1.0 KiB
C#

using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus;
using Yi.Framework.Bbs.Domain.Shared.Etos;
using Yi.Framework.DigitalCollectibles.Domain.Managers;
namespace Yi.Framework.DigitalCollectibles.Domain.EventHandlers;
public class SetAccountInfoEventHandler : ILocalEventHandler<SetAccountInfoEto>, ITransientDependency
{
private readonly CollectiblesManager _collectiblesManager;
private readonly InvitationCodeManager _invitationCodeManager;
public SetAccountInfoEventHandler(CollectiblesManager collectiblesManager,
InvitationCodeManager invitationCodeManager)
{
_collectiblesManager = collectiblesManager;
_invitationCodeManager = invitationCodeManager;
}
public async Task HandleEventAsync(SetAccountInfoEto eventData)
{
var userId = eventData.UserId;
//设置价值
eventData.Value = await _collectiblesManager.GetAccountValueAsync(userId);
//设置积分
eventData.Points = (await _invitationCodeManager.TryGetOrAddAsync(userId)).PointsNumber;
}
}