Elisa/Elisa.GameServer/Controllers/IndexController.cs

63 lines
2.1 KiB
C#
Raw Normal View History

using Elisa.Common.Utils;
using Microsoft.AspNetCore.Mvc;
namespace Elisa.GameServer.Controllers;
public class IndexController : Controller
{
[HttpPost("index.php", Name = "ServerList")]
public async Task<IResult> ServerList()
{
//read the serverlist
var text = System.IO.File.ReadAllText(@"Resources\serverList.xml");
return Results.Content(text, "text/html");
}
[HttpPost("index.php/1001/index/version", Name = "Version")]
public async Task<IResult> Version([FromQuery] string req_id)
{
return Results.Json(new
{
now = DateTime.Now.ToUnixSeconds(),
tomorrow_zero = Time.GetTomorrowZero(),
month_zero = Time.GetCurrentMonthZero(),
next_month_zero = Time.GetNextMonthZero(),
timezone = "PST8PDT",
data_version = GameServer.DataVersion,
client_version = GameServer.ClientVersion,
ab_version = GameServer.ABVersion,
is_kick = "0",
weekday = 1,
authentication_url = @"http://realauth.ucenter.ppgame.com/authoriz.html?appid={0}&openid={1}&accounttype=1&language=zh"
});
}
[HttpPost("index.php/1001/index/getUidEnMicaQueue", Name = "GetUidMicaQueue")]
public async Task<IResult> GetUidMicaQueue([FromQuery] string req_id)
{
return Results.Json(new
{
uid = "9303",
sign = "1f8063d3eb961af28f3fa5b90e9d3ba0",
is_username_exist = true,
real_name = 0,
authentication_url = @"http://realauth.ucenter.ppgame.com/authoriz.html?appid={0}&openid={1}&accounttype=1&language=zh",
tc_order_retry = 0
});
}
[HttpPost("index.php/1001/index/Index", Name = "Index")]
public async Task<IResult> Index([FromQuery] string req_id)
{
return Results.Json(new
{ });
}
/*
[Route("{*url}")]
public async Task<IActionResult> HandleAll(string url)
{
Log.Information("Handling unmatched request for URL: {Url}", url);
return Content($"Handled by catch-all route: {url}");
}
*/
}