diff --git a/Service/Application.Domain.Entity/game/user/unit_user_temp.cs b/Service/Application.Domain.Entity/game/user/unit_user_temp.cs index 87cd096..21834fb 100644 --- a/Service/Application.Domain.Entity/game/user/unit_user_temp.cs +++ b/Service/Application.Domain.Entity/game/user/unit_user_temp.cs @@ -18,18 +18,6 @@ namespace Application.Domain.Entity [SugarColumn(IsNullable = true)] public int? areaId { get; set; } - /// - /// lev - /// - [SugarColumn(IsNullable = true)] - public int? lev { get; set; } - - /// - /// 等级更新时间 - /// - [SugarColumn(IsNullable = true)] - public long? upTime { get; set; } - /// /// 人品 /// diff --git a/Service/Application.Domain.Entity/model/UserAttrModel.cs b/Service/Application.Domain.Entity/model/UserAttrModel.cs index cde35f4..168e436 100644 --- a/Service/Application.Domain.Entity/model/UserAttrModel.cs +++ b/Service/Application.Domain.Entity/model/UserAttrModel.cs @@ -17,7 +17,6 @@ public decimal luck { get; set; }//幸运 public int weight { get; set; }//负重 public int lev { get; set; }//等级 - public long upTime { get; set; } public int minAtk { get; set; }//最小攻击 public int maxAtk { get; set; }//最大攻击 public int defense { get; set; }//防御 diff --git a/Service/Application.Domain/Services/Interface/Business/IRankService.cs b/Service/Application.Domain/Services/Interface/Business/IRankService.cs index c35e6b6..1afb2d9 100644 --- a/Service/Application.Domain/Services/Interface/Business/IRankService.cs +++ b/Service/Application.Domain/Services/Interface/Business/IRankService.cs @@ -5,6 +5,7 @@ public interface IRankService Task GetRankUpdateTime(); Task> GetGameRank(int type, int area, int page, int limit, RefAsync total); Task> GetGameCopperRank(int area, int page, int limit, RefAsync total); + Task> GetGameLevRank(int area, int page, int limit, RefAsync total); Task> GetGameTeachAndRenownRank(int type, int area, int page, int limit, RefAsync total); Task HandleRank(); } \ No newline at end of file diff --git a/Service/Application.Domain/Services/Service/Business/RankService.cs b/Service/Application.Domain/Services/Service/Business/RankService.cs index d81ad7b..5228225 100644 --- a/Service/Application.Domain/Services/Service/Business/RankService.cs +++ b/Service/Application.Domain/Services/Service/Business/RankService.cs @@ -24,7 +24,6 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer var db = DbClient.AsTenant().GetConnectionWithAttr(); var data = await db.Queryable() .WhereIF(area != 0, it => it.areaId == area) - .WhereIF(type == 0, it => it.lev > 30) .WhereIF(type == 1, it => it.atk > 100) .WhereIF(type == 2, it => it.defense > 100) .WhereIF(type == 3, it => it.agility > 100) @@ -32,8 +31,6 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer .WhereIF(type == 5, it => it.upMorale > 0) .WhereIF(type == 6, it => it.luck > 0) .WhereIF(type == 7, it => it.score > 1000) - .OrderByIF(type == 0, it => it.lev, OrderByType.Desc) - .OrderByIF(type == 0, it => it.upTime, OrderByType.Desc) .OrderByIF(type == 1, it => it.atk, OrderByType.Desc) .OrderByIF(type == 2, it => it.defense, OrderByType.Desc) .OrderByIF(type == 3, it => it.agility, OrderByType.Desc) @@ -64,9 +61,6 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer string result = "0"; switch (type) { - case 0: - result = $"{Convert.ToString(data.lev)}级"; - break; case 1: result = Convert.ToString(data.atk); break; @@ -118,6 +112,32 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer return result; } + public async Task> GetGameLevRank(int area, int page, int limit, RefAsync total) + { + var db = DbClient.AsTenant().GetConnectionWithAttr(); + var data = await db.Queryable().LeftJoin((uc, u) => uc.userId == u.userId) + .WhereIF(area != 0, (uc, u) => u.areaId == area) + .Where((uc, u) => uc.lev > 29) + .Select() + .OrderByDescending(uc => uc.lev) + .OrderByDescending(uc=>uc.levUpdate) + .Take(100) + .ToListAsync(); + total = data.Count; + data = PageExtend.GetPageList(data, page, limit); + List result = new List(); + foreach (var item in data) + { + GameRankModel temp = new GameRankModel(); + temp.userId = item.userId; + temp.user = await UserModelTool.GetUserView(item.userId); + temp.sign = item.lev.ToString(); + temp.par = ""; + result.Add(temp); + } + + return result; + } public async Task> GetGameTeachAndRenownRank(int type, int area, int page, int limit, RefAsync total) { var db = DbClient.AsTenant().GetConnectionWithAttr(); @@ -170,8 +190,6 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer { userId = attrInfo.id, areaId = attrInfo.area, - lev = attrInfo.lev, - upTime = attrInfo.upTime, luck = attrInfo.luck, score = attrInfo.score, atk = attrInfo.maxAtk, diff --git a/Service/Application.Domain/Services/Service/User/UnitUserAttrService.cs b/Service/Application.Domain/Services/Service/User/UnitUserAttrService.cs index e91b73c..260db05 100644 --- a/Service/Application.Domain/Services/Service/User/UnitUserAttrService.cs +++ b/Service/Application.Domain/Services/Service/User/UnitUserAttrService.cs @@ -18,7 +18,6 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) : result.code = nameof(UserEnum.AttrCode.Person); var unitAttr = await GetUserAttr(userId); result.lev = (int)unitAttr.lev; - result.upTime = (long)unitAttr.levUpdate; result.minAtk = (int)unitAttr.minAtk; result.maxAtk = (int)unitAttr.maxAtk; result.defense = (int)unitAttr.defense; diff --git a/Service/Application.Web/Controllers/Pub/RankController.cs b/Service/Application.Web/Controllers/Pub/RankController.cs index 4cf6f99..83addde 100644 --- a/Service/Application.Web/Controllers/Pub/RankController.cs +++ b/Service/Application.Web/Controllers/Pub/RankController.cs @@ -30,7 +30,11 @@ public class RankController : ControllerBase RefAsync total = 0; string upTime = $"更新时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"; int area = StateHelper.areaId; - if (type is >= 0 and < 8) + if (type == 0) + { + data = await _rankService.GetGameLevRank(area, page, 10, total); + } + else if (type is >= 1 and < 8) { data = await _rankService.GetGameRank(type, area, page, 10, total); upTime = await _rankService.GetRankUpdateTime();