Elisa/Elisa.GameServer/Controllers/IndexController.cs

48 lines
1.5 KiB
C#

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()
{
return Results.Text(System.IO.File.ReadAllText(@"Resources\serverList.xml"));
}
[HttpGet("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"
});
}
[HttpGet("image/imageconfig.txt", Name = "ImageConfig")]
public async Task<IResult> ImageConfig()
{
return Results.Text(System.IO.File.ReadAllText(@"Resources\image\ImageConfig.txt"));
}
/*
[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}");
}
*/
}