🐞 fix(排行榜): 名将擂台的排行榜
This commit is contained in:
@@ -772,7 +772,7 @@ export class Rank {
|
||||
}
|
||||
|
||||
// 获取区间里的排行榜,格式 {rank, field, score}[]
|
||||
public async getRankByRangeRaw(max: number | string = '+inf', min: number | string = '-inf', isReverse = true) {
|
||||
public async getRankByRangeRaw(max: number | string = '+inf', min: number | string = '-inf', isReverse = true, byScore = false) {
|
||||
let ranks: { rank: number, field: string, scores: number[] }[] = [];
|
||||
let key = this.keyName.getName();
|
||||
if (this.isUnion) {
|
||||
@@ -780,11 +780,11 @@ export class Rank {
|
||||
}
|
||||
|
||||
const rankFromDb = isReverse?
|
||||
((max == '+inf' && min == '-inf')?
|
||||
(((max == '+inf' && min == '-inf') || byScore)?
|
||||
(await redisClient().zrevrangebyscoreAsync(key, max, min, "WITHSCORES")):
|
||||
(await redisClient().zrevrangeAsync(key, <number>min, <number>max, "WITHSCORES"))
|
||||
):
|
||||
((max == '+inf' && min == '-inf')?
|
||||
(((max == '+inf' && min == '-inf') || byScore)?
|
||||
(await redisClient().zrangebyscoreAsync(key, min, max, "WITHSCORES")):
|
||||
(await redisClient().zrangeAsync(key, <number>min, <number>max, "WITHSCORES"))
|
||||
)
|
||||
@@ -798,8 +798,8 @@ export class Rank {
|
||||
return ranks
|
||||
}
|
||||
|
||||
public async getRankByRange(max: number | string = '+inf', min: number | string = '-inf', isReverse = true) {
|
||||
let raws = await this.getRankByRangeRaw(max, min, isReverse);
|
||||
public async getRankByRange(max: number | string = '+inf', min: number | string = '-inf', isReverse = true, byScore = false) {
|
||||
let raws = await this.getRankByRangeRaw(max, min, isReverse, byScore);
|
||||
|
||||
let ranks = new Array<RoleRankInfo | GuildRankInfo | LeagueRankInfo>();
|
||||
let l = 1;
|
||||
|
||||
Reference in New Issue
Block a user