演武台:添加重置接口
This commit is contained in:
@@ -791,22 +791,20 @@ export class Rank {
|
||||
|
||||
private async generateUnionRank() {
|
||||
let unionKey = this.keyName.getUnionName(); // 联合的key
|
||||
let existsKey = await redisClient().existsAsync(unionKey);
|
||||
if (!existsKey) {
|
||||
let keys = [], weights = [];
|
||||
this.valueConfig.forEach(({ isMain, name, weight }) => {
|
||||
if(isMain) {
|
||||
keys.push(this.keyName.getName());
|
||||
} else {
|
||||
keys.push(this.keyName.getNameWithPlus(name));
|
||||
}
|
||||
weights.push(Math.pow(10, weight))
|
||||
|
||||
})
|
||||
let keys = [], weights = [];
|
||||
this.valueConfig.forEach(({ isMain, name, weight }) => {
|
||||
if(isMain) {
|
||||
keys.push(this.keyName.getName());
|
||||
} else {
|
||||
keys.push(this.keyName.getNameWithPlus(name));
|
||||
}
|
||||
weights.push(Math.pow(10, weight))
|
||||
|
||||
await redisClient().zunionstoreAsync(unionKey, 2, ...keys, 'WEIGHTS', ...weights);
|
||||
await redisClient().expireAsync(unionKey, this.unionRankLife); // 10秒更新一次
|
||||
}
|
||||
})
|
||||
|
||||
await redisClient().zunionstoreAsync(unionKey, 2, ...keys, 'WEIGHTS', ...weights);
|
||||
await redisClient().expireAsync(unionKey, this.unionRankLife); // 10秒更新一次
|
||||
return unionKey;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user