排行榜:修复数据错误

This commit is contained in:
luying
2021-09-10 17:39:22 +08:00
parent faf4d25f60
commit cec130b7c4
3 changed files with 29 additions and 13 deletions
+10 -10
View File
@@ -245,7 +245,7 @@ export class Rank {
if (!guild) {
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK)
}
let param = new GuildRankParam(guild);
let param = new GuildRankParam(guild, true);
await this.setUserInfo(infoKey, { guildCode }, param);
} else if (infoKey == REDIS_KEY.TOP_LINEUP_INFO) {
if (!role) {
@@ -458,12 +458,12 @@ export class Rank {
if (!guild) {
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK);
}
param = new GuildRankInfo(guild);
param = new GuildRankInfo(guild, true);
param.setInfo(0, { guildCode }, score, time);
} else {
const info = await redisClient().hgetAsync(this.infoKey, guildCode);
const guildInfo = JSON.parse(info);
param = new GuildRankInfo(guildInfo);
param = new GuildRankInfo(guildInfo, false);
param.setInfo(0, { guildCode }, score, time);
}
@@ -483,12 +483,12 @@ export class Rank {
if (!guild) {
guild = await GuildModel.findByCode(guildCode, this.keyName.serverId, GUILD_SELECT.RANK);
}
param = new GuildRankInfo(guild);
param = new GuildRankInfo(guild, true);
param.setInfo2(0, { guildCode }, score, time, active);
} else {
const info = await redisClient().hgetAsync(this.infoKey, guildCode);
const guildInfo = JSON.parse(info);
param = new GuildRankInfo(guildInfo);
param = new GuildRankInfo(guildInfo, false);
param.setInfo2(0, { guildCode }, score, time, active);
}
@@ -681,10 +681,10 @@ export class Rank {
param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]);
} else if (this.infoKey == REDIS_KEY.GUILD_INFO) {
if(this.key == REDIS_KEY.GUILD_LV_RANK) {
param = new GuildRankInfo(userInfo);
param = new GuildRankInfo(userInfo, false);
param.setInfo2(Math.floor(ii / 2) + 1, myId, scores[0], scores[1], scores[2]);
} else {
param = new GuildRankInfo(userInfo);
param = new GuildRankInfo(userInfo, false);
param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]);
}
}
@@ -727,10 +727,10 @@ export class Rank {
param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]);
} else if (this.infoKey == REDIS_KEY.GUILD_INFO) {
if(this.key == REDIS_KEY.GUILD_LV_RANK) {
param = new GuildRankInfo(userInfo);
param = new GuildRankInfo(userInfo, false);
param.setInfo2(Math.floor(ii / 2) + 1, myId, scores[0], scores[1], scores[2]);
} else {
param = new GuildRankInfo(userInfo);
param = new GuildRankInfo(userInfo, false);
param.setInfo(Math.floor(ii / 2) + 1, myId, scores[0], scores[1]);
}
}
@@ -818,7 +818,7 @@ export class Rank {
if(!reverse) {
encodeResult += score * Math.pow(10, weight);
} else {
let pow = Math.pow(10, len + 1);
let pow = Math.pow(10, len);
encodeResult += pow - 1 - score;
}
})