排行榜:加值使用增量逻辑反
This commit is contained in:
@@ -233,7 +233,7 @@ export class CityActivityHandler {
|
||||
|
||||
// 更新redis数据
|
||||
let myR = new Rank(REDIS_KEY.USER_CITY_ACTIVITY, { serverId, guildCode });
|
||||
let myScore = await myR.setRankWithRoleInfo(roleId, damage, Date.now(), null, false);
|
||||
let myScore = await myR.setRankWithRoleInfo(roleId, damage, Date.now(), null, true);
|
||||
await myR.setExpire(getNextHourPoint(5));
|
||||
|
||||
let r = new Rank(REDIS_KEY.CITY_ACTIVITY, { serverId, cityId }, true );
|
||||
|
||||
@@ -139,7 +139,7 @@ export class GateActivityHandler {
|
||||
|
||||
// 更新redis数据
|
||||
let myR = new Rank(REDIS_KEY.USER_GATE_ACTIVITY, { serverId, guildCode }, false);
|
||||
let myScore = await myR.setRankWithRoleInfo(roleId, score, Date.now(), null, false);
|
||||
let myScore = await myR.setRankWithRoleInfo(roleId, score, Date.now(), null, true);
|
||||
await myR.setExpire(getNextHourPoint(5));
|
||||
|
||||
let r = new Rank(REDIS_KEY.GATE_ACTIVITY, { serverId }, true);
|
||||
@@ -242,7 +242,7 @@ export class GateActivityHandler {
|
||||
await addActive(roleId, serverId, GUILD_POINT_WAYS.ACTIVITY); //获得活跃值
|
||||
// 返回当前军团总军功
|
||||
let guildScore = await r.getMyScore({guildCode});
|
||||
let myScore = await r.getMyScore({roleId});
|
||||
let myScore = await myR.getMyScore({roleId});
|
||||
let gateHp = obj.getGateHpAndInc(guildCode);
|
||||
|
||||
obj.delMemberRecord(code);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user