军团活动:修复粮草先行
This commit is contained in:
@@ -607,7 +607,11 @@ async function generateUnionRank(key: string, serverId: number, timelen = 10) {
|
||||
|
||||
let pow = Math.pow(10, timelen + 1);
|
||||
await redisClient().zunionstoreAsync(unionKey, 2, originKey, timeKey, 'WEIGHTS', pow, 1);
|
||||
await redisClient().expireAsync(unionKey, 10); // 10秒更新一次
|
||||
if(originKey.indexOf(REDIS_KEY.RACE_ACTIVITY) == -1) {
|
||||
await redisClient().expireAsync(unionKey, 10); // 10秒更新一次
|
||||
} else {
|
||||
await redisClient().expireAsync(unionKey, 1); // 1秒更新一次
|
||||
}
|
||||
}
|
||||
return unionKey;
|
||||
}
|
||||
@@ -621,7 +625,7 @@ async function generateUnionRank(key: string, serverId: number, timelen = 10) {
|
||||
export async function getUnionRank(key: string, serverId: number, roleId: string, timelen = 10, limit = 100) {
|
||||
|
||||
let ranks = [], myRank = null;
|
||||
let unionKey = await generateUnionRank(key, serverId);
|
||||
let unionKey = await generateUnionRank(key, serverId, timelen);
|
||||
const rankFromDb = await redisClient().zrevrangebyscoreAsync(unionKey, '+inf', '-inf', "WITHSCORES", "LIMIT", 0, limit);
|
||||
|
||||
let _key = key.split(':')[0];
|
||||
|
||||
Reference in New Issue
Block a user