From cb1384b24faac9ff0c947da2ac740860701c2294 Mon Sep 17 00:00:00 2001 From: luying Date: Fri, 9 Sep 2022 20:39:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E8=A1=8C=E6=A6=9C=EF=BC=9A=E9=98=B2?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/dungeonService.ts | 1 + game-server/app/services/rankService.ts | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/game-server/app/services/dungeonService.ts b/game-server/app/services/dungeonService.ts index 5ce755de6..fa7a629cf 100644 --- a/game-server/app/services/dungeonService.ts +++ b/game-server/app/services/dungeonService.ts @@ -105,6 +105,7 @@ export function getDungeonBuyCountCost(num:number) { } export async function saveDungeonFirst(role: RoleType, warId: number, battleRecord: BattleRecordType) { + if(!role) return null; let userInfo = new RankParam(role); let lineup = battleRecord.record.lineup; let dicWar = gameData.war.get(warId); diff --git a/game-server/app/services/rankService.ts b/game-server/app/services/rankService.ts index 969da22be..7044ef6f0 100644 --- a/game-server/app/services/rankService.ts +++ b/game-server/app/services/rankService.ts @@ -485,11 +485,13 @@ export class Rank { if (!hasCurUser) { if (!guild) { guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK); + if(!guild) return null } param = new GuildRankInfo(guild); param.setInfo(0, { guildCode }, score, time); } else { const info = await redisClient().hgetAsync(this.infoKey, guildCode); + if(!info) return null const guildInfo = JSON.parse(info); param = new GuildRankInfo(guildInfo); param.setInfo(0, { guildCode }, score, time); @@ -510,12 +512,14 @@ export class Rank { if (!hasCurUser) { if (!guild) { guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK); + if(!guild) return null } param = new GuildRankInfo(guild); param.setInfo2(0, { guildCode }, score, time, active); } else { const info = await redisClient().hgetAsync(this.infoKey, guildCode); const guildInfo = JSON.parse(info); + if(!guildInfo) return null param = new GuildRankInfo(guildInfo); param.setInfo2(0, { guildCode }, score, time, active); } @@ -745,7 +749,8 @@ export class Rank { const info = await redisClient().hgetAsync(this.infoKey, this.composeFields(this.infoKey, myId)); const userInfo = JSON.parse(info); - + if(!userInfo) return null; + let param: RoleRankInfo | GuildRankInfo; if (this.infoKey == REDIS_KEY.USER_INFO) { if (nowSeconds() - userInfo.updatedAt > 2 * 30 * 24 * 60 * 60) { @@ -905,6 +910,7 @@ export class Rank { private async getFirstUserInfo(myId: myIdInter) { const info = await redisClient().hgetAsync(this.infoKey, this.composeFields(this.infoKey, myId)); + if(!info) return null const playerInfo = JSON.parse(info); if (this.infoKey == REDIS_KEY.USER_INFO) {