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) {