🐞 fix(排行榜): 登录超时后排行榜中不再显示

This commit is contained in:
luying
2022-12-26 11:45:01 +08:00
parent a71034f181
commit 49c095979d

View File

@@ -667,6 +667,7 @@ export class Rank {
public async getRankListWithMyRank(myId: myIdInter, isReverse = true) {
let ranks = await this.getRankByRange('+inf', '-inf', isReverse);
console.log('#### ranks', ranks);
let newRanks = [], newMyRank: any;
let myRank = ranks.find(cur => {
return cur.isMyInfo(myId);
@@ -674,7 +675,7 @@ export class Rank {
if (this.generFields) {
for (let rank of ranks) {
let n = await this.generFields(rank);
newRanks.push(n);
if(n) newRanks.push(n);
}
if (myRank) {
newMyRank = await this.generFields(myRank);
@@ -737,9 +738,12 @@ export class Rank {
let raws = await this.getRankByRangeRaw(max, min, isReverse);
let ranks = new Array<RoleRankInfo | GuildRankInfo>();
for (let { rank, field, scores } of raws) {
let param = await this.getParam(rank, field, scores);
if(param) ranks.push(param);
let l = 1;
for (let { field, scores } of raws) {
let param = await this.getParam(l, field, scores);
if(param) {
ranks.push(param); l++;
}
}
return ranks
}