1
0
mirror of synced 2024-12-19 09:45:54 +01:00
GC-local-server-rewrite/Application/Game/Card/Read/ReadUnlockKeynumQuery.cs

36 lines
1.2 KiB
C#
Raw Normal View History

namespace Application.Game.Card.Read;
public record ReadUnlockKeynumQuery(long CardId) : IRequestWrapper<string>;
2023-02-16 17:38:01 +01:00
public class ReadUnlockKeynumQueryHandler : RequestHandlerBase<ReadUnlockKeynumQuery, string>
{
2023-02-13 17:38:19 +01:00
private const string UNLOCK_KEYNUM_XPATH = "/root/unlock_keynum/record";
public ReadUnlockKeynumQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
{
}
public override Task<ServiceResult<string>> Handle(ReadUnlockKeynumQuery request, CancellationToken cancellationToken)
{
2023-02-13 17:38:19 +01:00
var unlockables = Config.UnlockRewards;
var list = unlockables.Select((unlockable, index) => new UnlockKeyNumDto
{
Id = index,
CardId = request.CardId,
RewardId = unlockable.RewardId,
KeyNum = 0,
RewardCount = 0,
CashFlag = 0,
ExpiredFlag = 0,
UseFlag = 1,
Created = "2013-01-01 08:00:00",
Modified = "2020-01-01 08:00:00"
})
.ToList();
var result = list.SerializeCardDataList(UNLOCK_KEYNUM_XPATH);
return Task.FromResult(new ServiceResult<string>(result));
}
}