排行榜:防报错
This commit is contained in:
@@ -105,6 +105,7 @@ export function getDungeonBuyCountCost(num:number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function saveDungeonFirst(role: RoleType, warId: number, battleRecord: BattleRecordType) {
|
export async function saveDungeonFirst(role: RoleType, warId: number, battleRecord: BattleRecordType) {
|
||||||
|
if(!role) return null;
|
||||||
let userInfo = new RankParam(role);
|
let userInfo = new RankParam(role);
|
||||||
let lineup = battleRecord.record.lineup;
|
let lineup = battleRecord.record.lineup;
|
||||||
let dicWar = gameData.war.get(warId);
|
let dicWar = gameData.war.get(warId);
|
||||||
|
|||||||
@@ -485,11 +485,13 @@ export class Rank {
|
|||||||
if (!hasCurUser) {
|
if (!hasCurUser) {
|
||||||
if (!guild) {
|
if (!guild) {
|
||||||
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK);
|
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK);
|
||||||
|
if(!guild) return null
|
||||||
}
|
}
|
||||||
param = new GuildRankInfo(guild);
|
param = new GuildRankInfo(guild);
|
||||||
param.setInfo(0, { guildCode }, score, time);
|
param.setInfo(0, { guildCode }, score, time);
|
||||||
} else {
|
} else {
|
||||||
const info = await redisClient().hgetAsync(this.infoKey, guildCode);
|
const info = await redisClient().hgetAsync(this.infoKey, guildCode);
|
||||||
|
if(!info) return null
|
||||||
const guildInfo = JSON.parse(info);
|
const guildInfo = JSON.parse(info);
|
||||||
param = new GuildRankInfo(guildInfo);
|
param = new GuildRankInfo(guildInfo);
|
||||||
param.setInfo(0, { guildCode }, score, time);
|
param.setInfo(0, { guildCode }, score, time);
|
||||||
@@ -510,12 +512,14 @@ export class Rank {
|
|||||||
if (!hasCurUser) {
|
if (!hasCurUser) {
|
||||||
if (!guild) {
|
if (!guild) {
|
||||||
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK);
|
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK);
|
||||||
|
if(!guild) return null
|
||||||
}
|
}
|
||||||
param = new GuildRankInfo(guild);
|
param = new GuildRankInfo(guild);
|
||||||
param.setInfo2(0, { guildCode }, score, time, active);
|
param.setInfo2(0, { guildCode }, score, time, active);
|
||||||
} else {
|
} else {
|
||||||
const info = await redisClient().hgetAsync(this.infoKey, guildCode);
|
const info = await redisClient().hgetAsync(this.infoKey, guildCode);
|
||||||
const guildInfo = JSON.parse(info);
|
const guildInfo = JSON.parse(info);
|
||||||
|
if(!guildInfo) return null
|
||||||
param = new GuildRankInfo(guildInfo);
|
param = new GuildRankInfo(guildInfo);
|
||||||
param.setInfo2(0, { guildCode }, score, time, active);
|
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 info = await redisClient().hgetAsync(this.infoKey, this.composeFields(this.infoKey, myId));
|
||||||
const userInfo = JSON.parse(info);
|
const userInfo = JSON.parse(info);
|
||||||
|
if(!userInfo) return null;
|
||||||
|
|
||||||
let param: RoleRankInfo | GuildRankInfo;
|
let param: RoleRankInfo | GuildRankInfo;
|
||||||
if (this.infoKey == REDIS_KEY.USER_INFO) {
|
if (this.infoKey == REDIS_KEY.USER_INFO) {
|
||||||
if (nowSeconds() - userInfo.updatedAt > 2 * 30 * 24 * 60 * 60) {
|
if (nowSeconds() - userInfo.updatedAt > 2 * 30 * 24 * 60 * 60) {
|
||||||
@@ -905,6 +910,7 @@ export class Rank {
|
|||||||
|
|
||||||
private async getFirstUserInfo(myId: myIdInter) {
|
private async getFirstUserInfo(myId: myIdInter) {
|
||||||
const info = await redisClient().hgetAsync(this.infoKey, this.composeFields(this.infoKey, myId));
|
const info = await redisClient().hgetAsync(this.infoKey, this.composeFields(this.infoKey, myId));
|
||||||
|
if(!info) return null
|
||||||
const playerInfo = JSON.parse(info);
|
const playerInfo = JSON.parse(info);
|
||||||
|
|
||||||
if (this.infoKey == REDIS_KEY.USER_INFO) {
|
if (this.infoKey == REDIS_KEY.USER_INFO) {
|
||||||
|
|||||||
Reference in New Issue
Block a user