1
0
mirror of synced 2024-12-20 18:25:52 +01:00
GC-local-server-rewrite/Application/Game/Card/Session/GetSessionCommand.cs
2023-02-09 23:19:14 +08:00

30 lines
984 B
C#

using Application.Common.Extensions;
using Application.Common.Models;
using Application.Dto;
using Application.Interfaces;
namespace Application.Game.Card.Session;
public record GetSessionCommand(long CardId, string Mac) : IRequestWrapper<string>;
public class GetSessionCommandHandler : CardRequestHandlerBase<GetSessionCommand, string>
{
private const string SESSION_XPATH = "/root/session";
public GetSessionCommandHandler(ICardDependencyAggregate aggregate) : base(aggregate)
{
}
public override Task<ServiceResult<string>> Handle(GetSessionCommand request, CancellationToken cancellationToken)
{
var session = new SessionDto
{
CardId = request.CardId,
Mac = request.Mac,
PlayerId = 1,
Expires = 9999,
SessionId = "12345678901234567890123456789012"
};
return Task.FromResult(new ServiceResult<string>(session.SerializeCardData(SESSION_XPATH)));
}
}