KafkaSR/RPG.Services.SDK/Handlers/DispatchHandler.cs
2024-01-30 02:49:21 +03:00

42 lines
1.1 KiB
C#

using Google.Protobuf;
using Microsoft.AspNetCore.Http.HttpResults;
using RPG.Network.Proto;
using RPG.Services.SDK.Models.Region;
namespace RPG.Services.SDK.Handlers;
public static class DispatchHandler
{
private const string QueryGatewayUrl = "http://127.0.0.1:8888/query_gateway";
public static JsonHttpResult<QueryDispatchHttpRsp> OnQueryDispatch()
{
return TypedResults.Json(new QueryDispatchHttpRsp
{
Retcode = 0,
TopServerRegionName = "KafkaSR",
RegionList =
[
new RegionInfo
{
EnvType = "2",
DispatchUrl = QueryGatewayUrl,
Name = "KafkaSR",
Title = "KafkaSR"
}
]
});
}
public static ContentHttpResult OnQueryGateway()
{
return TypedResults.Text(Convert.ToBase64String(new Gateserver
{
Msg = "OK",
RegionName = "KafkaSR",
Ip = "127.0.0.1",
Port = 20301,
UseTcp = true
}.ToByteArray()));
}
}