This commit is contained in:
Putoo
2026-07-15 12:55:22 +08:00
parent 77fcf4ea47
commit c9c870004b
10 changed files with 39 additions and 27 deletions

View File

@@ -40,7 +40,7 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
.OrderByIF(type == 7, it => it.score, OrderByType.Desc)
.Take(100)
.ToListAsync();
total = data.Count;
total.Value = data.Count;
data = PageExtend.GetPageList(data, page, limit);
List<GameRankModel> result = new List<GameRankModel>();
foreach (var item in data)
@@ -97,7 +97,7 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
.OrderByDescending(uc => uc.copper)
.Take(100)
.ToListAsync();
total = data.Count;
total.Value = data.Count;
data = PageExtend.GetPageList(data, page, limit);
List<GameRankModel> result = new List<GameRankModel>();
foreach (var item in data)
@@ -120,10 +120,10 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
.Where((uc, u) => uc.lev > 29)
.Select<unit_user_attr>()
.OrderByDescending(uc => uc.lev)
.OrderByDescending(uc=>uc.levUpdate)
.OrderBy(uc=>uc.levUpdate,OrderByType.Asc)
.Take(100)
.ToListAsync();
total = data.Count;
total.Value = data.Count;
data = PageExtend.GetPageList(data, page, limit);
List<GameRankModel> result = new List<GameRankModel>();
foreach (var item in data)
@@ -152,7 +152,7 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
.OrderByIF(type == 11, uc => uc.charm, OrderByType.Desc)
.Take(100)
.ToListAsync();
total = data.Count;
total.Value = data.Count;
data = PageExtend.GetPageList(data, page, limit);
List<GameRankModel> result = new List<GameRankModel>();
foreach (var item in data)

View File

@@ -57,12 +57,12 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
}
public async Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex,
int PageSize, RefAsync<int> Total,int DealType)
int PageSize, RefAsync<int> Total, int DealType)
{
long onTime = TimeExtend.GetTimeStampSeconds;
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
return await db.Queryable<unit_user_equ>().Where(it =>
it.userId == userId && it.isOn == 0 && it.isLock == 0 &&
it.userId == userId && it.isOn == 0 && it.isLock == 0 &&
it.useEndTime > onTime)
.WhereIF(DealType == 0, it => it.isDeal == 1)
.WhereIF(DealType == 1, it => it.isDeal == 1 && it.isGive == 1)
@@ -627,7 +627,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
await redis.SetAsync(key, result, 300);
}
return result;
return result == null ? new List<AttrItem>() : result;
}
#endregion

View File

@@ -233,6 +233,9 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
{
await UserStateTool.SetUserMapDefault(lowUser);
}
//战败后,结束挂机
var hookService = App.GetService<IOnHookService>();
await hookService.StopOnHook(lowUser);
fightData.state = 1;
fightData.winCode = nameof(UserEnum.AttrCode.Person);
@@ -414,7 +417,7 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
var cityInfo = await mapService.GetCityInfo((int)mapInfo.cityId);
var winUserInfo = await userService.GetUserInfoByUserId(winUser);
var lowUserInfo = await userService.GetUserInfoByUserId(lowUser);
//系统广播
string boradMsg =
$"[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]在{cityInfo.cityName}·{mapInfo.mapName}击杀了[{UbbTool.HomeUbb(lowUserInfo.userNo, lowUserInfo.nick)}]!";
@@ -424,7 +427,7 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
string noticeMsg =
$"您在{cityInfo.cityName}·{mapInfo.mapName}被[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]击杀!";
await chatService.SendChat(lowUser, (int)lowUserInfo.areaId, nameof(GameChatEnum.Code.Notice), noticeMsg);
if (mapInfo.isPk == 1)
if (mapInfo.isPk == 1 && fightData.userId == winUser)
{
var relationService = App.GetService<IUnitUserRelationService>();
if (await relationService.CheckUserEnemy(winUser, lowUser) == false)

View File

@@ -125,11 +125,9 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
var loadState = await GetUserLoadState(userId);
result = await GameAttrTool.CheckRoleLoadBuff(result, loadState);
result = await ReviseUserRoleAttr(result);
return result;
#endregion
return result;
}
catch (Exception e)
@@ -588,13 +586,15 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
var data = await redis.GetHashAsync<List<unit_user_state>>(key, userId);
if (data == null)
{
long endTime = TimeExtend.GetTimeStampSeconds;
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_state>();
data = await db.Queryable<unit_user_state>().Where(it => it.userId == userId && it.endTime > endTime)
data = await db.Queryable<unit_user_state>().Where(it => it.userId == userId)
.ToListAsync();
await redis.AddHashAsync(key, userId, data);
}
long endTime = TimeExtend.GetTimeStampSeconds;
data = data.FindAll(it => it.endTime > endTime);
return data;
}