活动:限时排行榜

This commit is contained in:
luying
2022-03-04 09:47:24 +08:00
parent d0eb46ece4
commit f099daf80b
27 changed files with 871 additions and 151 deletions
+32 -7
View File
@@ -7,6 +7,7 @@ import { HeroType, } from "../db/Hero";
import { getSeconds } from "../pubUtils/timeUtil";
import { prop } from "@typegoose/typegoose";
import { pick } from "underscore";
import { REDIS_KEY } from "../consts";
// 排行榜返回玩家值
export class RankParam {
@@ -317,6 +318,7 @@ export class KeyName {
cityId?: number;
hid?: number;
seasonNum?: number;
activityId?: number;
constructor(key: string, param: KeyNameParam) {
this.key = key;
@@ -325,16 +327,39 @@ export class KeyName {
if(param.cityId) this.cityId = param.cityId;
if(param.hid) this.hid = param.hid;
if(param.seasonNum) this.seasonNum = param.seasonNum;
if(param.activityId) this.activityId = param.activityId;
}
public getName() {
let res = this.key;
if(this.serverId) res += `:${this.serverId}`;
if(this.guildCode) res += `:${this.guildCode}`;
if(this.cityId) res += `:${this.cityId}`;
if(this.hid) res += `:${this.hid}`;
if(this.seasonNum) res += `:${this.seasonNum}`;
return res;
switch(this.key) {
case REDIS_KEY.TOP_LINEUP_RANK:
case REDIS_KEY.TOP_HERO_RANK:
case REDIS_KEY.HERO_NUM_RANK:
case REDIS_KEY.SUM_CE_RANK:
case REDIS_KEY.USER_LV:
case REDIS_KEY.MAIN_RANK:
case REDIS_KEY.MAIN_ELITE_RANK:
case REDIS_KEY.GUILD_LV_RANK:
case REDIS_KEY.GUILD_ACTIVE_RANK:
case REDIS_KEY.GATE_ACTIVITY:
case REDIS_KEY.RACE_ACTIVITY:
case REDIS_KEY.TOWER_RANK:
return `${this.key}:${this.serverId}`;
case REDIS_KEY.HERO_RANK:
return `${this.key}:${this.serverId}:${this.hid}`;
case REDIS_KEY.PVP_RANK:
return `${this.key}:${this.seasonNum}`;
case REDIS_KEY.CITY_ACTIVITY:
return `${this.key}:${this.serverId}:${this.cityId}`;
case REDIS_KEY.USER_CITY_ACTIVITY:
REDIS_KEY.USER_GATE_ACTIVITY
return `${this.key}:${this.serverId}:${this.guildCode}`;
case REDIS_KEY.GUILD_FUND:
case REDIS_KEY.SUM_CE_SNAPSHOT:
return `${this.key}:${this.serverId}:${this.activityId}`;
default:
return this.key;
}
}
public getNameWithPlus(...plus: string[]) {