1212
This commit is contained in:
50
Service/Application.Web/Controllers/Pub/RankController.cs
Normal file
50
Service/Application.Web/Controllers/Pub/RankController.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Application.Web.Controllers.Pub;
|
||||
|
||||
/// <summary>
|
||||
/// 排行接口
|
||||
/// </summary>
|
||||
[Route("[controller]/[action]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class RankController : ControllerBase
|
||||
{
|
||||
private readonly IRankService _rankService;
|
||||
|
||||
public RankController(IRankService rankService)
|
||||
{
|
||||
_rankService = rankService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取排名数据
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="page"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetRankData(int type, int page)
|
||||
{
|
||||
List<GameRankModel> data = new List<GameRankModel>();
|
||||
RefAsync<int> total = 0;
|
||||
string upTime = $"更新时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}";
|
||||
int area = StateHelper.areaId;
|
||||
if (type is >= 0 and < 8)
|
||||
{
|
||||
data = await _rankService.GetGameRank(type, area, page, 10, total);
|
||||
upTime = await _rankService.GetRankUpdateTime();
|
||||
}
|
||||
else if (type == 8)
|
||||
{
|
||||
data = await _rankService.GetGameCopperRank(area, page, 10, total);
|
||||
}
|
||||
else if (type == 9 || type == 10 || type == 11)
|
||||
{
|
||||
data = await _rankService.GetGameTeachAndRenownRank(type, area, page, 10, total);
|
||||
}
|
||||
|
||||
|
||||
return PoAction.Ok(new { upTime, data, total = total.Value });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user