排行榜:配置空排名

This commit is contained in:
luying
2022-08-22 18:35:30 +08:00
parent 0ea0523808
commit 54a03584c7
2 changed files with 18 additions and 2 deletions
+16
View File
@@ -370,6 +370,22 @@ export function completeLadderRanks(ranks: RoleAndGuildRankInfo[]) {
return result;
}
export function completeRanks(ranks: RoleAndGuildRankInfo[]) {
let max = Math.max(...ranks.map(cur => cur.rank), 0);
if(max > 200) max = 200;
let result: RoleAndGuildRankInfo[] = [];
for(let i = 1; i <= max; i++) {
let rank = ranks.find(cur => cur.rank == i);
if(rank) {
result.push(rank);
} else {
let rank = new RoleAndGuildRankInfo(i, 0);
result.push(rank);
}
}
return result;
}
export async function sendLadderDailyReward(serverId: number) {
let ranks = await getLadderMatchByRank(serverId, '+inf', '-inf');
for(let { rank, roleId } of ranks) {