演武台:添加重置接口

This commit is contained in:
luying
2021-10-20 19:08:49 +08:00
parent 237c2ffa1f
commit a5a4604b61
4 changed files with 55 additions and 34 deletions
+12 -14
View File
@@ -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;
}