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

43 lines
1.4 KiB
C#
Raw Normal View History

using Application.Common.Extensions;
using Application.Common.Models;
2023-02-13 17:38:19 +01:00
using Application.Dto;
using Application.Interfaces;
using Domain.Enums;
using Microsoft.EntityFrameworkCore;
namespace Application.Game.Card.Read;
public record ReadUnlockKeynumQuery(long CardId) : IRequestWrapper<string>;
public class ReadUnlockKeynumQueryHandler : CardRequestHandlerBase<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));
}
}