pvp刷新规则,区段没有人时刷前后一名

This commit is contained in:
luying
2021-01-08 20:02:23 +08:00
parent c743e2bd40
commit c3b4a59906
6 changed files with 227 additions and 127 deletions
+8
View File
@@ -127,6 +127,14 @@ export async function getMyRank(key: string, serverId: number, roleId: string) {
return myRank + 1;
}
// 获取排名第几名的信息
export async function getFieldByRank(key: string, serverId: number, rank: number) {
const client: Redis.RedisClient = pinus.app.get('redis');
let myRank = await client.zrevrangeAsync(getKeyName(key, serverId), rank - 1, rank - 1);
console.log('****', JSON.stringify(myRank))
return myRank;
}
// 有序排行综合时间和得分排序
function encodeScoreWithTime(score: number, timestamp: number): number {
// value = score * Math.power(10, 14) + max_time - timestamp