using Microsoft.AspNetCore.Mvc; namespace Application.Web.Controllers.Pub; /// /// 排行接口 /// [Route("[controller]/[action]")] [ApiController] [Authorize] public class RankController : ControllerBase { private readonly IRankService _rankService; public RankController(IRankService rankService) { _rankService = rankService; } /// /// 获取排名数据 /// /// /// /// [HttpGet] public async Task GetRankData(int type, int page) { List data = new List(); RefAsync 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 }); } }