121212133
This commit is contained in:
@@ -18,18 +18,6 @@ namespace Application.Domain.Entity
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? areaId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// lev
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? lev { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 等级更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public long? upTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人品
|
||||
/// </summary>
|
||||
|
||||
@@ -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; }//防御
|
||||
|
||||
@@ -5,6 +5,7 @@ public interface IRankService
|
||||
Task<string> GetRankUpdateTime();
|
||||
Task<List<GameRankModel>> GetGameRank(int type, int area, int page, int limit, RefAsync<int> total);
|
||||
Task<List<GameRankModel>> GetGameCopperRank(int area, int page, int limit, RefAsync<int> total);
|
||||
Task<List<GameRankModel>> GetGameLevRank(int area, int page, int limit, RefAsync<int> total);
|
||||
Task<List<GameRankModel>> GetGameTeachAndRenownRank(int type, int area, int page, int limit, RefAsync<int> total);
|
||||
Task HandleRank();
|
||||
}
|
||||
@@ -24,7 +24,6 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_temp>();
|
||||
var data = await db.Queryable<unit_user_temp>()
|
||||
.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<List<GameRankModel>> GetGameLevRank(int area, int page, int limit, RefAsync<int> total)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_attr>();
|
||||
var data = await db.Queryable<unit_user_attr>().LeftJoin<unit_user>((uc, u) => uc.userId == u.userId)
|
||||
.WhereIF(area != 0, (uc, u) => u.areaId == area)
|
||||
.Where((uc, u) => uc.lev > 29)
|
||||
.Select<unit_user_attr>()
|
||||
.OrderByDescending(uc => uc.lev)
|
||||
.OrderByDescending(uc=>uc.levUpdate)
|
||||
.Take(100)
|
||||
.ToListAsync();
|
||||
total = data.Count;
|
||||
data = PageExtend.GetPageList(data, page, limit);
|
||||
List<GameRankModel> result = new List<GameRankModel>();
|
||||
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<List<GameRankModel>> GetGameTeachAndRenownRank(int type, int area, int page, int limit, RefAsync<int> total)
|
||||
{
|
||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_data>();
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -30,7 +30,11 @@ public class RankController : ControllerBase
|
||||
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)
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user