排行榜:加值使用增量逻辑反

This commit is contained in:
luying
2021-04-12 14:52:55 +08:00
parent 3f9fc1abe8
commit 75d706ccae
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -87,7 +87,7 @@ export class Rank {
* @param role 玩家数据库数据
* @param isInc 得分是累加上的还是直接设置的
*/
public async setRankWithRoleInfo(roleId: string, score: number, timestamp: number, role?: RoleType, isInc = true) {
public async setRankWithRoleInfo(roleId: string, score: number, timestamp: number, role?: RoleType, isInc = false) {
// 如果没有信息,更新玩家信息
for (let infoKey of [this.infoKey, ...this.extraKeys]) {
const hasCurUser = await redisClient().hexistsAsync(infoKey, roleId);
@@ -108,7 +108,7 @@ export class Rank {
* @param guild 军团数据库
* @param isInc 得分是累加上的还是直接设置的
*/
public async setRankWithGuildInfo(guildCode: string, score: number, timestamp: number, guild?: GuildType, isInc = true) {
public async setRankWithGuildInfo(guildCode: string, score: number, timestamp: number, guild?: GuildType, isInc = false) {
for (let infoKey of [this.infoKey, ...this.extraKeys]) {
const hasCurUser = await redisClient().hexistsAsync(infoKey, guildCode);
if (!hasCurUser) {
@@ -311,7 +311,7 @@ export class Rank {
let scoreStr = this.encodeScore(newScore, timestamp);
await redisClient().zaddAsync(key, scoreStr, this.composeFields(this.key, myId));
return score
return newScore
}
/**