Migrate read
This commit is contained in:
parent
1fccca42c6
commit
5c85e83c3e
15
Application/Dto/CardBDatumDto.cs
Normal file
15
Application/Dto/CardBDatumDto.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class CardBDatumDto
|
||||
{
|
||||
[XmlElement(ElementName = "card_id")]
|
||||
public long CardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "bdata")]
|
||||
public string CardBdata { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement(ElementName = "bdata_size")]
|
||||
public int BDataSize { get; set; }
|
||||
}
|
@ -51,7 +51,7 @@ public class CardDetailDto
|
||||
|
||||
[XmlElement(ElementName = "last_play_tenpo_id")]
|
||||
[DefaultValue("GC local server")]
|
||||
public string LastPlayShopId { get; set; } = "GC local server";
|
||||
public string LastPlayTenpoId { get; set; } = "GC local server";
|
||||
|
||||
[XmlElement("fcol1")]
|
||||
public int Fcol1 { get; set; }
|
||||
|
24
Application/Dto/CoinDto.cs
Normal file
24
Application/Dto/CoinDto.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class CoinDto
|
||||
{
|
||||
[XmlElement(ElementName = "card_id")]
|
||||
public long CardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "current")]
|
||||
public int CurrentCoins { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "total")]
|
||||
public int TotalCoins { get; set; }
|
||||
|
||||
[XmlElement("monthly")]
|
||||
public int MonthlyCoins { get; set; }
|
||||
|
||||
[XmlElement("created")]
|
||||
public string Created { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("modified")]
|
||||
public string Modified { get; set; } = string.Empty;
|
||||
}
|
15
Application/Dto/MusicAouDto.cs
Normal file
15
Application/Dto/MusicAouDto.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class MusicAouDto
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "music_id")]
|
||||
public int MusicId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "use_flag")]
|
||||
public int UseFlag { get; set; }
|
||||
}
|
15
Application/Dto/MusicExtraDto.cs
Normal file
15
Application/Dto/MusicExtraDto.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class MusicExtraDto
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "music_id")]
|
||||
public int MusicId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "use_flag")]
|
||||
public int UseFlag { get; set; }
|
||||
}
|
27
Application/Dto/NavigatorDto.cs
Normal file
27
Application/Dto/NavigatorDto.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class NavigatorDto
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "card_id")]
|
||||
public long CardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "navigator_id")]
|
||||
public int NavigatorId { get; set; }
|
||||
|
||||
[XmlElement("created")]
|
||||
public string Created { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("modified")]
|
||||
public string Modified { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("new_flag")]
|
||||
public int NewFlag { get; set; }
|
||||
|
||||
[XmlElement("use_flag")]
|
||||
public int UseFlag { get; set; }
|
||||
}
|
27
Application/Dto/SkinDto.cs
Normal file
27
Application/Dto/SkinDto.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class SkinDto
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "card_id")]
|
||||
public long CardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "skin_id")]
|
||||
public int SkinId { get; set; }
|
||||
|
||||
[XmlElement("created")]
|
||||
public string Created { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("modified")]
|
||||
public string Modified { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("new_flag")]
|
||||
public int NewFlag { get; set; }
|
||||
|
||||
[XmlElement("use_flag")]
|
||||
public int UseFlag { get; set; }
|
||||
}
|
27
Application/Dto/SoundEffectDto.cs
Normal file
27
Application/Dto/SoundEffectDto.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class SoundEffectDto
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "card_id")]
|
||||
public long CardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "sound_effect_id")]
|
||||
public int SoundEffectId { get; set; }
|
||||
|
||||
[XmlElement("created")]
|
||||
public string Created { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("modified")]
|
||||
public string Modified { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("new_flag")]
|
||||
public int NewFlag { get; set; }
|
||||
|
||||
[XmlElement("use_flag")]
|
||||
public int UseFlag { get; set; }
|
||||
}
|
27
Application/Dto/TitleDto.cs
Normal file
27
Application/Dto/TitleDto.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class TitleDto
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "card_id")]
|
||||
public long CardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "title_id")]
|
||||
public int TitleId { get; set; }
|
||||
|
||||
[XmlElement("created")]
|
||||
public string Created { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("modified")]
|
||||
public string Modified { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("new_flag")]
|
||||
public int NewFlag { get; set; }
|
||||
|
||||
[XmlElement("use_flag")]
|
||||
public int UseFlag { get; set; }
|
||||
}
|
12
Application/Dto/TotalTrophyDto.cs
Normal file
12
Application/Dto/TotalTrophyDto.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class TotalTrophyDto
|
||||
{
|
||||
[XmlElement(ElementName = "card_id")]
|
||||
public long CardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "total_trophy_num")]
|
||||
public int TrophyNum { get; set; }
|
||||
}
|
36
Application/Dto/UnlockKeyNumDto.cs
Normal file
36
Application/Dto/UnlockKeyNumDto.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Application.Dto;
|
||||
|
||||
public class UnlockKeyNumDto
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "card_id")]
|
||||
public long CardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "reward_id")]
|
||||
public int RewardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "key_num")]
|
||||
public int KeyNum { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "reward_count")]
|
||||
public int RewardCount { get; set; }
|
||||
|
||||
[XmlElement("expired_flag")]
|
||||
public int ExpiredFlag { get; set; }
|
||||
|
||||
[XmlElement("use_flag")]
|
||||
public int UseFlag { get; set; }
|
||||
|
||||
[XmlElement("cash_flag")]
|
||||
public int CashFlag { get; set; }
|
||||
|
||||
[XmlElement("created")]
|
||||
public string Created { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("modified")]
|
||||
public string Modified { get; set; } = string.Empty;
|
||||
}
|
@ -14,8 +14,8 @@ public record ReadAllCardDetailsQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadAllCardDetailsQueryHandler : CardRequestHandlerBase<ReadAllCardDetailsQuery, string>
|
||||
{
|
||||
private const string CARD_DETAILS_XPATH = "/root/card_detail/record";
|
||||
private const string EMPTY_XPATH = "/root/card_detail";
|
||||
private const string CARD_DETAILS_XPATH = "/root/card_detail";
|
||||
private const string RECORD_XPATH = $"{CARD_DETAILS_XPATH}/record";
|
||||
|
||||
private readonly ILogger<ReadAllCardDetailsQueryHandler> logger;
|
||||
|
||||
@ -43,7 +43,7 @@ public class ReadAllCardDetailsQueryHandler : CardRequestHandlerBase<ReadAllCard
|
||||
string result;
|
||||
if (cardDetails.Count == 0)
|
||||
{
|
||||
result = new object().SerializeCardData(EMPTY_XPATH);
|
||||
result = new object().SerializeCardData(CARD_DETAILS_XPATH);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -53,7 +53,7 @@ public class ReadAllCardDetailsQueryHandler : CardRequestHandlerBase<ReadAllCard
|
||||
dto.Id = i;
|
||||
return dto;
|
||||
});
|
||||
result = dtoList.SerializeCardDataList(CARD_DETAILS_XPATH);
|
||||
result = dtoList.SerializeCardDataList(RECORD_XPATH);
|
||||
}
|
||||
|
||||
return new ServiceResult<string>(result);
|
||||
|
@ -31,8 +31,8 @@ public class ReadAvatarQueryHandler : CardRequestHandlerBase<ReadAvatarQuery, st
|
||||
Id = i,
|
||||
CardId = request.CardId,
|
||||
AvatarId = i,
|
||||
Created = "2013-01-01",
|
||||
Modified = "2013-01-01",
|
||||
Created = "2013-01-01 08:00:00",
|
||||
Modified = "2013-01-01 08:00:00",
|
||||
NewFlag = 0,
|
||||
UseFlag = 1
|
||||
};
|
||||
|
@ -1,8 +1,10 @@
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Interfaces;
|
||||
using Application.Mappers;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Application.Game.Card.Read;
|
||||
|
||||
@ -11,12 +13,31 @@ public record ReadCardBDataQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadCardBDataQueryHandler : CardRequestHandlerBase<ReadCardBDataQuery, string>
|
||||
{
|
||||
public ReadCardBDataQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
private const string CARD_BDATA_XPATH = "/root/card_bdata";
|
||||
|
||||
private readonly ILogger<ReadCardBDataQueryHandler> logger;
|
||||
|
||||
public ReadCardBDataQueryHandler(ICardDependencyAggregate aggregate, ILogger<ReadCardBDataQueryHandler> logger) : base(aggregate)
|
||||
{
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadCardBDataQuery request, CancellationToken cancellationToken)
|
||||
public override async Task<ServiceResult<string>> Handle(ReadCardBDataQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var exists = await CardDbContext.CardMains.AnyAsync(card => card.CardId == request.CardId, cancellationToken: cancellationToken);
|
||||
if (!exists)
|
||||
{
|
||||
logger.LogWarning("Card id: {CardId} does not exist!", request.CardId);
|
||||
return ServiceResult.Failed<string>(
|
||||
new ServiceError($"Card id: {request.CardId} does not exist!", (int)CardReturnCode.CardNotRegistered));
|
||||
}
|
||||
|
||||
var bdata = await CardDbContext.CardBdata.FirstOrDefaultAsync(
|
||||
card => card.CardId == request.CardId, cancellationToken: cancellationToken);
|
||||
|
||||
var result = bdata?.CardBDatumToDto().SerializeCardData(CARD_BDATA_XPATH)
|
||||
?? new object().SerializeCardData(CARD_BDATA_XPATH);
|
||||
|
||||
return new ServiceResult<string>(result);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Dto;
|
||||
using Application.Interfaces;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -11,12 +12,26 @@ public record ReadCoinQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadCoinQueryHandler : CardRequestHandlerBase<ReadCoinQuery, string>
|
||||
{
|
||||
private const string COIN_XPATH = "/root/coin";
|
||||
|
||||
public ReadCoinQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadCoinQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var dto = new CoinDto
|
||||
{
|
||||
CardId = request.CardId,
|
||||
CurrentCoins = 900000,
|
||||
MonthlyCoins = 900000,
|
||||
TotalCoins = 900000,
|
||||
Created = "2013-01-01 08:00:00",
|
||||
Modified = "2013-01-01 08:00:00"
|
||||
};
|
||||
|
||||
var result = dto.SerializeCardData(COIN_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,16 @@ public record ReadCondQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadCondQueryHandler : CardRequestHandlerBase<ReadCondQuery, string>
|
||||
{
|
||||
private const string COND_XPATH = "/root/cond";
|
||||
|
||||
public ReadCondQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadCondQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var result = new object().SerializeCardData(COND_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,16 @@ public record ReadEventRewardQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadEventRewardQueryHandler : CardRequestHandlerBase<ReadEventRewardQuery, string>
|
||||
{
|
||||
private const string EVENT_REWARD_XPATH = "/root/event_reward";
|
||||
|
||||
public ReadEventRewardQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadEventRewardQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var result = new object().SerializeCardData(EVENT_REWARD_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
@ -11,12 +11,16 @@ public record ReadGetMessageQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadGetMessageQueryHandler : CardRequestHandlerBase<ReadGetMessageQuery, string>
|
||||
{
|
||||
private const string GET_MESSAGE_XPATH = "/root/get_message";
|
||||
|
||||
public ReadGetMessageQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadGetMessageQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var result = new object().SerializeCardData(GET_MESSAGE_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Interfaces;
|
||||
using Application.Mappers;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@ -11,12 +14,29 @@ public record ReadMusicAouQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadMusicAouQueryHandler : CardRequestHandlerBase<ReadMusicAouQuery, string>
|
||||
{
|
||||
private const string MUSIC_AOU_XPATH = "/root/music_aou";
|
||||
|
||||
private const string RECORD_XPATH = $"{MUSIC_AOU_XPATH}/record";
|
||||
|
||||
public ReadMusicAouQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadMusicAouQuery request, CancellationToken cancellationToken)
|
||||
[SuppressMessage("ReSharper.DPA", "DPA0007: Large number of DB records",
|
||||
Justification = "To return all musics, the whole table need to be returned")]
|
||||
public override async Task<ServiceResult<string>> Handle(ReadMusicAouQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var musics = await MusicDbContext.MusicAous.ToListAsync(cancellationToken: cancellationToken);
|
||||
var dtoList = musics.Select((aou, i) =>
|
||||
{
|
||||
var dto = aou.MusicAouToDto();
|
||||
dto.Id = i;
|
||||
return dto;
|
||||
}).ToList();
|
||||
|
||||
var result = dtoList.Count == 0 ? new object().SerializeCardData(MUSIC_AOU_XPATH)
|
||||
: dtoList.SerializeCardDataList(RECORD_XPATH);
|
||||
|
||||
return new ServiceResult<string>(result);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Interfaces;
|
||||
using Application.Mappers;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@ -11,12 +12,27 @@ public record ReadMusicExtraQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadMusicExtraQueryHandler : CardRequestHandlerBase<ReadMusicExtraQuery, string>
|
||||
{
|
||||
private const string MUSIC_EXTRA_XPATH = "/root/music_extra";
|
||||
|
||||
private const string RECORD_XPATH = $"{MUSIC_EXTRA_XPATH}/record";
|
||||
|
||||
public ReadMusicExtraQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadMusicExtraQuery request, CancellationToken cancellationToken)
|
||||
public override async Task<ServiceResult<string>> Handle(ReadMusicExtraQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var musics = await MusicDbContext.MusicExtras.ToListAsync(cancellationToken: cancellationToken);
|
||||
var dtoList = musics.Select((aou, i) =>
|
||||
{
|
||||
var dto = aou.MusicExtraToDto();
|
||||
dto.Id = i;
|
||||
return dto;
|
||||
}).ToList();
|
||||
|
||||
var result = dtoList.Count == 0 ? new object().SerializeCardData(MUSIC_EXTRA_XPATH)
|
||||
: dtoList.SerializeCardDataList(RECORD_XPATH);
|
||||
|
||||
return new ServiceResult<string>(result);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Dto;
|
||||
using Application.Interfaces;
|
||||
using Domain.Config;
|
||||
using Domain.Enums;
|
||||
@ -13,6 +14,7 @@ public record ReadNavigatorQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadNavigatorQueryHandler : CardRequestHandlerBase<ReadNavigatorQuery, string>
|
||||
{
|
||||
private const string NAVIGATOR_XPATH = "/root/navigator/record";
|
||||
|
||||
public ReadNavigatorQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
@ -20,6 +22,26 @@ public class ReadNavigatorQueryHandler : CardRequestHandlerBase<ReadNavigatorQue
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadNavigatorQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var count = Config.NavigatorCount;
|
||||
|
||||
var list = new List<NavigatorDto>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var navigator = new NavigatorDto
|
||||
{
|
||||
Id = i,
|
||||
CardId = request.CardId,
|
||||
NavigatorId = i,
|
||||
Created = "2013-01-01 08:00:00",
|
||||
Modified = "2013-01-01 08:00:00",
|
||||
NewFlag = 0,
|
||||
UseFlag = 1
|
||||
};
|
||||
list.Add(navigator);
|
||||
}
|
||||
|
||||
var result = list.SerializeCardDataList(NAVIGATOR_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Dto;
|
||||
using Application.Interfaces;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -11,12 +12,34 @@ public record ReadSkinQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadSkinQueryHandler : CardRequestHandlerBase<ReadSkinQuery, string>
|
||||
{
|
||||
private const string SKIN_XPATH = "/root/skin/record";
|
||||
|
||||
public ReadSkinQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadSkinQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var count = Config.SkinCount;
|
||||
|
||||
var list = new List<SkinDto>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var skin = new SkinDto
|
||||
{
|
||||
Id = i,
|
||||
CardId = request.CardId,
|
||||
SkinId = i,
|
||||
Created = "2013-01-01 08:00:00",
|
||||
Modified = "2013-01-01 08:00:00",
|
||||
NewFlag = 0,
|
||||
UseFlag = 1
|
||||
};
|
||||
list.Add(skin);
|
||||
}
|
||||
|
||||
var result = list.SerializeCardDataList(SKIN_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Dto;
|
||||
using Application.Interfaces;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -11,12 +12,33 @@ public record ReadSoundEffectQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadSoundEffectQueryHandler : CardRequestHandlerBase<ReadSoundEffectQuery, string>
|
||||
{
|
||||
private const string SOUND_EFFECT_XPATH = "/root/sound_effect/record";
|
||||
public ReadSoundEffectQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadSoundEffectQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var count = Config.SeCount;
|
||||
|
||||
var list = new List<SoundEffectDto>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var soundEffect = new SoundEffectDto
|
||||
{
|
||||
Id = i,
|
||||
CardId = request.CardId,
|
||||
SoundEffectId = i,
|
||||
Created = "2013-01-01 08:00:00",
|
||||
Modified = "2013-01-01 08:00:00",
|
||||
NewFlag = 0,
|
||||
UseFlag = 1
|
||||
};
|
||||
list.Add(soundEffect);
|
||||
}
|
||||
|
||||
var result = list.SerializeCardDataList(SOUND_EFFECT_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Dto;
|
||||
using Application.Interfaces;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -11,12 +12,34 @@ public record ReadTitleQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadTitleQueryHandler : CardRequestHandlerBase<ReadTitleQuery, string>
|
||||
{
|
||||
private const string TITLE_XPATH = "/root/title/record";
|
||||
|
||||
public ReadTitleQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadTitleQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var count = Config.TitleCount;
|
||||
|
||||
var list = new List<TitleDto>();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var soundEffect = new TitleDto
|
||||
{
|
||||
Id = i,
|
||||
CardId = request.CardId,
|
||||
TitleId = i,
|
||||
Created = "2013-01-01 08:00:00",
|
||||
Modified = "2013-01-01 08:00:00",
|
||||
NewFlag = 0,
|
||||
UseFlag = 1
|
||||
};
|
||||
list.Add(soundEffect);
|
||||
}
|
||||
|
||||
var result = list.SerializeCardDataList(TITLE_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Dto;
|
||||
using Application.Interfaces;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -11,12 +12,22 @@ public record ReadTotalTrophyQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadTotalTrophyQueryHandler : CardRequestHandlerBase<ReadTotalTrophyQuery, string>
|
||||
{
|
||||
private const string TOTAL_TROPHY_XPATH = "/root/total_trophy";
|
||||
|
||||
public ReadTotalTrophyQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadTotalTrophyQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var trophy = new TotalTrophyDto
|
||||
{
|
||||
CardId = request.CardId,
|
||||
TrophyNum = 8
|
||||
};
|
||||
|
||||
var result = trophy.SerializeCardData(TOTAL_TROPHY_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Dto;
|
||||
using Application.Interfaces;
|
||||
using Domain.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -11,12 +12,31 @@ public record ReadUnlockKeynumQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadUnlockKeynumQueryHandler : CardRequestHandlerBase<ReadUnlockKeynumQuery, string>
|
||||
{
|
||||
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)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
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));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System.Xml.Serialization;
|
||||
using Application.Common.Extensions;
|
||||
using Application.Common.Models;
|
||||
using Application.Interfaces;
|
||||
@ -11,12 +12,96 @@ public record ReadUnlockRewardQuery(long CardId) : IRequestWrapper<string>;
|
||||
|
||||
public class ReadUnlockRewardQueryHandler : CardRequestHandlerBase<ReadUnlockRewardQuery, string>
|
||||
{
|
||||
private const string UNLOCK_REWARD_XPATH = "/root/unlock_reward/record";
|
||||
|
||||
public ReadUnlockRewardQueryHandler(ICardDependencyAggregate aggregate) : base(aggregate)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<ServiceResult<string>> Handle(ReadUnlockRewardQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var config = Config.UnlockRewards;
|
||||
var list = config.Select((rewardConfig, i) => new UnlockRewardModel
|
||||
{
|
||||
Id = i,
|
||||
CardId = request.CardId,
|
||||
RewardId = rewardConfig.RewardId,
|
||||
RewardType = rewardConfig.RewardType,
|
||||
TargetId = rewardConfig.TargetId,
|
||||
TargetNum = rewardConfig.TargetNum,
|
||||
KeyNum = rewardConfig.KeyNum,
|
||||
DisplayFlag = 1,
|
||||
UseFlag = 1,
|
||||
LimitedFlag = 0,
|
||||
Created = "2013-01-01 08:00:00",
|
||||
Modified = "2013-01-01 08:00:00",
|
||||
OpenDate = "2013-01-01",
|
||||
CloseDate = "2030-01-01",
|
||||
OpenTime = "00:00:01",
|
||||
CloseTime = "23:59:59",
|
||||
OpenUnixTime = new DateTimeOffset(2013, 1, 1, 0, 0, 1, TimeSpan.Zero).ToUnixTimeSeconds(),
|
||||
CloseUnixTime = new DateTimeOffset(2030, 1, 1, 23, 59, 59, TimeSpan.Zero).ToUnixTimeSeconds()
|
||||
});
|
||||
|
||||
var result = list.SerializeCardDataList(UNLOCK_REWARD_XPATH);
|
||||
|
||||
return Task.FromResult(new ServiceResult<string>(result));
|
||||
}
|
||||
}
|
||||
|
||||
public class UnlockRewardModel
|
||||
{
|
||||
[XmlAttribute(AttributeName = "id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "card_id")]
|
||||
public long CardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "reward_id")]
|
||||
public int RewardId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "reward_type")]
|
||||
public int RewardType { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "open_date")]
|
||||
public string OpenDate { get; set; } = "2013-01-01";
|
||||
|
||||
[XmlElement(ElementName = "close_date")]
|
||||
public string CloseDate { get; set; } = "2030-01-01";
|
||||
|
||||
[XmlElement(ElementName = "open_time")]
|
||||
public string OpenTime { get; set; } = "00:00:01";
|
||||
|
||||
[XmlElement(ElementName = "close_time")]
|
||||
public string CloseTime { get; set; } = "23:59:59";
|
||||
|
||||
[XmlElement(ElementName = "target_id")]
|
||||
public int TargetId { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "target_num")]
|
||||
public int TargetNum { get; set; }
|
||||
|
||||
[XmlElement(ElementName = "key_num")]
|
||||
public int KeyNum { get; set; }
|
||||
|
||||
[XmlElement("display_flag")]
|
||||
public int DisplayFlag { get; set; }
|
||||
|
||||
[XmlElement("use_flag")]
|
||||
public int UseFlag { get; set; }
|
||||
|
||||
[XmlElement("limited_flag")]
|
||||
public int LimitedFlag { get; set; }
|
||||
|
||||
[XmlElement("open_unixtime")]
|
||||
public long OpenUnixTime { get; set; }
|
||||
|
||||
[XmlElement("close_unixtime")]
|
||||
public long CloseUnixTime { get; set; }
|
||||
|
||||
[XmlElement("created")]
|
||||
public string Created { get; set; } = string.Empty;
|
||||
|
||||
[XmlElement("modified")]
|
||||
public string Modified { get; set; } = string.Empty;
|
||||
}
|
||||
|
11
Application/Mappers/CardBDatumMapper.cs
Normal file
11
Application/Mappers/CardBDatumMapper.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using Application.Dto;
|
||||
using Domain.Entities;
|
||||
using Riok.Mapperly.Abstractions;
|
||||
|
||||
namespace Application.Mappers;
|
||||
|
||||
[Mapper]
|
||||
public static partial class CardBDatumMapper
|
||||
{
|
||||
public static partial CardBDatumDto CardBDatumToDto(this CardBdatum cardBdatum);
|
||||
}
|
@ -8,4 +8,6 @@ namespace Application.Mappers;
|
||||
public static partial class CardDetailMapper
|
||||
{
|
||||
public static partial CardDetailDto CardDetailToDto(this CardDetail cardDetail);
|
||||
|
||||
public static partial CardDetail DtoToCardDetail(this CardDetailDto dto);
|
||||
}
|
13
Application/Mappers/MusicAouMapper.cs
Normal file
13
Application/Mappers/MusicAouMapper.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Application.Dto;
|
||||
using Domain.Entities;
|
||||
using Riok.Mapperly.Abstractions;
|
||||
|
||||
namespace Application.Mappers;
|
||||
|
||||
[Mapper]
|
||||
public static partial class MusicAouMapper
|
||||
{
|
||||
public static partial MusicAouDto MusicAouToDto(this MusicAou musicAou);
|
||||
|
||||
private static int BoolToInt(bool value) => value ? 1 : 0;
|
||||
}
|
13
Application/Mappers/MusicExtraMapper.cs
Normal file
13
Application/Mappers/MusicExtraMapper.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Application.Dto;
|
||||
using Domain.Entities;
|
||||
using Riok.Mapperly.Abstractions;
|
||||
|
||||
namespace Application.Mappers;
|
||||
|
||||
[Mapper]
|
||||
public static partial class MusicExtraMapper
|
||||
{
|
||||
public static partial MusicExtraDto MusicExtraToDto(this MusicExtra musicExtra);
|
||||
|
||||
private static int BoolToInt(bool value) => value ? 1 : 0;
|
||||
}
|
@ -17,4 +17,6 @@ public class GameConfig
|
||||
public int TitleCount { get; set; }
|
||||
|
||||
public List<int> UnlockableSongIds { get; set; } = new();
|
||||
|
||||
public List<UnlockRewardConfig> UnlockRewards { get; set; } = new();
|
||||
}
|
14
Domain/Config/UnlockRewardConfig.cs
Normal file
14
Domain/Config/UnlockRewardConfig.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace Domain.Config;
|
||||
|
||||
public class UnlockRewardConfig
|
||||
{
|
||||
public int RewardId { get; set; }
|
||||
|
||||
public int RewardType { get; set; }
|
||||
|
||||
public int TargetId { get; set; }
|
||||
|
||||
public int TargetNum { get; set; }
|
||||
|
||||
public int KeyNum { get; set; }
|
||||
}
|
@ -12,6 +12,43 @@
|
||||
494, 498, 520, 548, 551, 558, 561, 565, 570, 577, 583, 612, 615, 622,
|
||||
632, 659, 666, 668, 670, 672, 676, 680, 682, 685, 686, 697, 700, 701,
|
||||
711, 720, 749, 875, 876, 877
|
||||
],
|
||||
"UnlockReward": [
|
||||
{
|
||||
"RewardId" : 1,
|
||||
"RewardType" : 1,
|
||||
"TargetId" : 1,
|
||||
"TargetNum": 1,
|
||||
"KeyNum": 1
|
||||
},
|
||||
{
|
||||
"RewardId" : 2,
|
||||
"RewardType" : 2,
|
||||
"TargetId" : 11,
|
||||
"TargetNum": 1,
|
||||
"KeyNum": 1
|
||||
},
|
||||
{
|
||||
"RewardId" : 3,
|
||||
"RewardType" : 3,
|
||||
"TargetId" : 11,
|
||||
"TargetNum": 1,
|
||||
"KeyNum": 1
|
||||
},
|
||||
{
|
||||
"RewardId" : 4,
|
||||
"RewardType" : 4,
|
||||
"TargetId" : 11,
|
||||
"TargetNum": 1,
|
||||
"KeyNum": 1
|
||||
},
|
||||
{
|
||||
"RewardId" : 5,
|
||||
"RewardType" : 5,
|
||||
"TargetId" : 11,
|
||||
"TargetNum": 1,
|
||||
"KeyNum": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user