活动:限时排行榜
This commit is contained in:
@@ -53,6 +53,7 @@ export enum ACTIVITY_TYPE {
|
||||
NEW_HERO_GK = 38, //新将演绎 (配置N个武将,每个武将有X个关卡;活动期间,*天(时间自定义)开启每个武将对应的一个关卡,只有第一次通关会获得奖励)
|
||||
NEW_HERO_GACHA = 39, //新将擢迁(新武将抽卡)
|
||||
LUCKY_TURNTABLE = 40, // 幸运转盘
|
||||
TIME_LIMIT_RANK = 41, // 限时排行榜
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,8 +47,9 @@ export enum MAIL_TYPE {
|
||||
EQUIP_OVER = 18, // 装备超数量
|
||||
TOWER_TASK_REWARD = 19, // 镇念塔派遣过期奖励
|
||||
MONTHLY_REWARD = 20, // 月卡奖品
|
||||
TREAT_ROLE_NAME = 21, // 月卡奖品
|
||||
TREAT_GUILD_INFO = 22, // 月卡奖品
|
||||
TREAT_ROLE_NAME = 21, // 改玩家名
|
||||
TREAT_GUILD_INFO = 22, // 改军团名
|
||||
TIME_LIMIT_RANK = 23, // 限时排行榜
|
||||
};
|
||||
|
||||
export const SEND_NAME = '系统';
|
||||
|
||||
@@ -238,36 +238,59 @@ export enum REDIS_KEY {
|
||||
PAY_CHANNEL = 'pay', // 支付订阅频道
|
||||
TREAT_ROLE_CHANNEL = 'treatRole', // 处理玩家账号名频道
|
||||
TREAT_GUILD_CHANNEL = 'treatGuild', // 处理公会账号名频道
|
||||
GUILD_FUND = 'guildFund', // 限时排行
|
||||
SUM_CE_SNAPSHOT = "sumCeTL", // 限时战力排行榜
|
||||
}
|
||||
|
||||
// 各排行榜对应hash的key
|
||||
export const REDIS_RANK_TO_INFO = new Map([
|
||||
[REDIS_KEY.TOWER_RANK, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.PVP_RANK, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.GUILD_ACTIVE_RANK, REDIS_KEY.GUILD_INFO],
|
||||
[REDIS_KEY.GUILD_LV_RANK, REDIS_KEY.GUILD_INFO],
|
||||
[REDIS_KEY.GATE_ACTIVITY, REDIS_KEY.GUILD_INFO],
|
||||
[REDIS_KEY.USER_GATE_ACTIVITY, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.CITY_ACTIVITY, REDIS_KEY.GUILD_INFO],
|
||||
[REDIS_KEY.USER_CITY_ACTIVITY, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.RACE_ACTIVITY, REDIS_KEY.GUILD_INFO],
|
||||
[REDIS_KEY.TOP_LINEUP_RANK, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.TOP_HERO_RANK, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.HERO_NUM_RANK, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.USER_LV, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.SUM_CE_RANK, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.DUNGEON_RANK, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.MAIN_RANK, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.MAIN_ELITE_RANK, REDIS_KEY.USER_INFO],
|
||||
[REDIS_KEY.HERO_RANK, REDIS_KEY.USER_INFO]
|
||||
]);
|
||||
export function getInfoKeyByRedisKey(redisKey: REDIS_KEY) {
|
||||
switch(redisKey) {
|
||||
case REDIS_KEY.TOWER_RANK: // 天梯排行榜
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
case REDIS_KEY.PVP_RANK: // pvp排行榜
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
case REDIS_KEY.TOP_LINEUP_RANK: // 最强阵容排行
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [REDIS_KEY.TOP_LINEUP_INFO] };
|
||||
case REDIS_KEY.TOP_HERO_RANK: // 最强武将排行
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [REDIS_KEY.HERO_INFO] };
|
||||
case REDIS_KEY.HERO_NUM_RANK: // 武将数量排行
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
case REDIS_KEY.USER_LV: // 主公等级排行榜
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
case REDIS_KEY.SUM_CE_RANK: // 总战力排名
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
case REDIS_KEY.DUNGEON_RANK: // 秘境排名
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [REDIS_KEY.DUNGEON_LINEUP] };
|
||||
case REDIS_KEY.MAIN_RANK: // 主线通关排名
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
case REDIS_KEY.MAIN_ELITE_RANK: // 精英通关排名
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
case REDIS_KEY.HERO_RANK: // 武将排行榜
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [REDIS_KEY.HERO_INFO] };
|
||||
|
||||
case REDIS_KEY.GUILD_ACTIVE_RANK: // 公会周活跃排行榜
|
||||
return { infoKey: REDIS_KEY.GUILD_INFO, extraKey: [] };
|
||||
case REDIS_KEY.GUILD_LV_RANK: // 公会等级排行榜
|
||||
return { infoKey: REDIS_KEY.GUILD_INFO, extraKey: [] };
|
||||
case REDIS_KEY.GUILD_FUND: // 军团资金
|
||||
return { infoKey: REDIS_KEY.GUILD_INFO, extraKey: [] };
|
||||
|
||||
export const REDIS_RANK_TO_EXTRA = new Map([
|
||||
[REDIS_KEY.TOP_LINEUP_RANK, [REDIS_KEY.TOP_LINEUP_INFO]],
|
||||
[REDIS_KEY.TOP_HERO_RANK, [REDIS_KEY.HERO_INFO]],
|
||||
[REDIS_KEY.DUNGEON_RANK, [REDIS_KEY.DUNGEON_LINEUP]],
|
||||
[REDIS_KEY.HERO_RANK, [REDIS_KEY.HERO_INFO]]
|
||||
]);
|
||||
case REDIS_KEY.GATE_ACTIVITY: // 蛮夷入侵军团排行
|
||||
return { infoKey: REDIS_KEY.GUILD_INFO, extraKey: [] };
|
||||
case REDIS_KEY.USER_GATE_ACTIVITY: // 蛮夷入侵玩家排行
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
case REDIS_KEY.CITY_ACTIVITY: // 诸侯混战军团排行
|
||||
return { infoKey: REDIS_KEY.GUILD_INFO, extraKey: [] };
|
||||
case REDIS_KEY.USER_CITY_ACTIVITY: // 诸侯混战玩家排行
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
case REDIS_KEY.RACE_ACTIVITY: // 粮草先行军团排行
|
||||
return { infoKey: REDIS_KEY.GUILD_INFO, extraKey: [] };
|
||||
|
||||
case REDIS_KEY.SUM_CE_SNAPSHOT: // 战力限时排行榜的快照
|
||||
return { infoKey: REDIS_KEY.USER_INFO, extraKey: [] };
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 排行榜类型
|
||||
export enum RANK_TYPE {
|
||||
@@ -279,26 +302,43 @@ export enum RANK_TYPE {
|
||||
TOWER = 6, // 镇念塔
|
||||
MAIN = 7, // 主线
|
||||
MAIN_ELITE = 8, // 精英
|
||||
GUILD_LV = 9, // 军团按等级排序
|
||||
GUILD_LV = 9, // 军团按等级排序
|
||||
GUILD_ACTIVE = 11, // 军团活跃度排序
|
||||
HERO = 12, // 武将排行
|
||||
GUILD_FUND = 13, // 军团积分排行,限时类型的排行榜,仅计算期限内增加的值
|
||||
}
|
||||
|
||||
// 接口中的排行榜类型对应的redis中的key
|
||||
export const RANK_TYPE_TO_KEY = new Map([
|
||||
[RANK_TYPE.TOP_LINTUP, REDIS_KEY.TOP_LINEUP_RANK],
|
||||
[RANK_TYPE.TOP_HERO, REDIS_KEY.TOP_HERO_RANK],
|
||||
[RANK_TYPE.HERO_NUM, REDIS_KEY.HERO_NUM_RANK],
|
||||
[RANK_TYPE.USER_LV, REDIS_KEY.USER_LV],
|
||||
[RANK_TYPE.SUM_CE, REDIS_KEY.SUM_CE_RANK],
|
||||
[RANK_TYPE.TOWER, REDIS_KEY.TOWER_RANK],
|
||||
// [RANK_TYPE.DUNGEON, REDIS_KEY.DUNGEON_RANK],
|
||||
[RANK_TYPE.MAIN, REDIS_KEY.MAIN_RANK],
|
||||
[RANK_TYPE.MAIN_ELITE, REDIS_KEY.MAIN_ELITE_RANK],
|
||||
[RANK_TYPE.GUILD_LV, REDIS_KEY.GUILD_LV_RANK],
|
||||
[RANK_TYPE.GUILD_ACTIVE, REDIS_KEY.GUILD_ACTIVE_RANK],
|
||||
[RANK_TYPE.HERO, REDIS_KEY.HERO_RANK]
|
||||
]);
|
||||
export function getRedisKeyByRankType(rankType: RANK_TYPE, isTimelimit = false) {
|
||||
switch(rankType) {
|
||||
case RANK_TYPE.TOP_LINTUP: // 最强阵容战力
|
||||
return REDIS_KEY.TOP_LINEUP_RANK;
|
||||
case RANK_TYPE.TOP_HERO: // 最强武将
|
||||
return REDIS_KEY.TOP_HERO_RANK;
|
||||
case RANK_TYPE.HERO_NUM: // 武将数量
|
||||
return REDIS_KEY.HERO_NUM_RANK;
|
||||
case RANK_TYPE.USER_LV: // 主公等级
|
||||
return REDIS_KEY.USER_LV;
|
||||
case RANK_TYPE.SUM_CE: // 总战力
|
||||
return isTimelimit? REDIS_KEY.SUM_CE_SNAPSHOT: REDIS_KEY.SUM_CE_RANK;
|
||||
case RANK_TYPE.TOWER: // 镇念塔
|
||||
return REDIS_KEY.TOWER_RANK;
|
||||
case RANK_TYPE.MAIN: // 主线
|
||||
return REDIS_KEY.MAIN_RANK;
|
||||
case RANK_TYPE.MAIN_ELITE: // 精英
|
||||
return REDIS_KEY.MAIN_ELITE_RANK;
|
||||
case RANK_TYPE.GUILD_LV: // 军团按等级排序
|
||||
return REDIS_KEY.GUILD_LV_RANK;
|
||||
case RANK_TYPE.GUILD_ACTIVE: // 军团活跃度排序
|
||||
return REDIS_KEY.GUILD_ACTIVE_RANK;
|
||||
case RANK_TYPE.HERO: // 武将排行
|
||||
return REDIS_KEY.HERO_RANK;
|
||||
case RANK_TYPE.GUILD_FUND: // 军团积分排行,限时类型的排行榜,仅计算期限内增加的值
|
||||
return REDIS_KEY.GUILD_FUND;
|
||||
}
|
||||
}
|
||||
|
||||
export const RANK_TYPE_TO_KEY = new Map();
|
||||
|
||||
// field处理方法
|
||||
export enum COMPOSE_FIELD_TYPE {
|
||||
@@ -334,7 +374,8 @@ export const KEY_TO_COMPOSE_FIELD = new Map([
|
||||
[REDIS_KEY.SHOW_LINEUP, COMPOSE_FIELD_TYPE.ROLE],
|
||||
[REDIS_KEY.SUM_CE_RANK, COMPOSE_FIELD_TYPE.ROLE],
|
||||
[REDIS_KEY.PVP_RANK, COMPOSE_FIELD_TYPE.ROLE],
|
||||
|
||||
[REDIS_KEY.GUILD_FUND, COMPOSE_FIELD_TYPE.GUILD],
|
||||
[REDIS_KEY.SUM_CE_SNAPSHOT, COMPOSE_FIELD_TYPE.ROLE],
|
||||
]);
|
||||
|
||||
|
||||
|
||||
@@ -11,4 +11,5 @@ export enum DATA_NAME {
|
||||
GAMEMAIL = 'Mail',
|
||||
AUCTION_LOT = 'LotCode',
|
||||
DONATE = 'Donate',
|
||||
FUND = 'fund',
|
||||
}
|
||||
|
||||
66
shared/db/ActivityTimeLimitRank.ts
Normal file
66
shared/db/ActivityTimeLimitRank.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType, Ref, mongoose } from '@typegoose/typegoose';
|
||||
import Guild from './Guild';
|
||||
import Role, { } from './Role';
|
||||
|
||||
/**
|
||||
* 活动系统 - 限时排行榜
|
||||
*/
|
||||
@index({ activityId: 1 })
|
||||
|
||||
export default class Activity_Time_Limit_Rank extends BaseModel {
|
||||
@prop({ required: true })
|
||||
serverId: number; // 区Id
|
||||
|
||||
@prop({ required: true })
|
||||
activityId: number; // 活动Id
|
||||
|
||||
@prop({ required: false })
|
||||
guildCode: string; // 军团
|
||||
|
||||
@prop({ ref: 'Guild', type: mongoose.Schema.Types.ObjectId })
|
||||
guild: Ref<Guild>;
|
||||
|
||||
@prop({ required: false })
|
||||
roleId: string; // 军团
|
||||
|
||||
@prop({ ref: 'Role', type: mongoose.Schema.Types.ObjectId })
|
||||
role: Ref<Role>;
|
||||
|
||||
@prop({ required: true })
|
||||
score: number; // 活动期间内的积分
|
||||
|
||||
@prop({ required: true })
|
||||
time: number; // 更新时间
|
||||
|
||||
public static async addGuildScore(serverId: number, activityId: number, rankType: number, guildCode: string, fund: number, guild?: string) {
|
||||
let rec: ActivityTimeLimitRankModelType = await ActivityTimeLimitRankModel.findOneAndUpdate({
|
||||
serverId, activityId, guildCode
|
||||
}, {
|
||||
$setOnInsert: { guild }, $set: { time: Date.now(), rankType }, $inc: { score: fund }
|
||||
}, { new: true, upsert: true }).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async findByCode(serverId: number, activityId: number, guildCode: string) {
|
||||
let rec: ActivityTimeLimitRankModelType = await ActivityTimeLimitRankModel.findOne({ serverId, activityId, guildCode }).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async insertRanks(insertInfos: ActivityTimeLimitRankModelTypeParam[]) {
|
||||
await ActivityTimeLimitRankModel.insertMany(insertInfos);
|
||||
return <ActivityTimeLimitRankModelType[]>insertInfos;
|
||||
}
|
||||
|
||||
public static async getRank(serverId: number, activityId: number) {
|
||||
let rec: ActivityTimeLimitRankModelType[] = await ActivityTimeLimitRankModel.find({ serverId, activityId })
|
||||
.populate('role').populate('guild')
|
||||
.sort({ score: 1, time: -1 }).lean();
|
||||
return rec;
|
||||
}
|
||||
}
|
||||
|
||||
export const ActivityTimeLimitRankModel = getModelForClass(Activity_Time_Limit_Rank);
|
||||
|
||||
export interface ActivityTimeLimitRankModelType extends Pick<DocumentType<Activity_Time_Limit_Rank>, keyof Activity_Time_Limit_Rank> { }
|
||||
export type ActivityTimeLimitRankModelTypeParam = Partial<ActivityTimeLimitRankModelType>; // 将所有字段变成可选项
|
||||
@@ -59,6 +59,12 @@ export default class Guild extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
fund: number;
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
todayFund: number; // 今天获得的资金,只增不减
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
refTodayFund: Date;
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
activeDaily: number;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { deltaDays } from '../../pubUtils/util';
|
||||
// 活动数据
|
||||
export abstract class ActivityBase {
|
||||
activityId: number = 0;
|
||||
name: string = '';
|
||||
beginTime: number = 0;
|
||||
endTime: number = 0;
|
||||
type: number = 0;
|
||||
@@ -23,9 +24,27 @@ export abstract class ActivityBase {
|
||||
}
|
||||
|
||||
public canShow() {
|
||||
console.log('#### canShow', this.beginTime <= Date.now(), this.endTime >= Date.now())
|
||||
return this.beginTime <= Date.now() && this.endTime >= Date.now()
|
||||
}
|
||||
|
||||
/**
|
||||
* getBaseKeys
|
||||
*/
|
||||
public getBaseKeys() {
|
||||
return {
|
||||
activityId: this.activityId,
|
||||
name: this.name,
|
||||
beginTime: this.beginTime,
|
||||
endTime: this.endTime,
|
||||
type: this.type,
|
||||
todayIndex: this.todayIndex,
|
||||
delayDay: this.delayDay,
|
||||
roundIndex: this.roundIndex,
|
||||
nextRefreshTime: this.nextRefreshTime,
|
||||
}
|
||||
}
|
||||
|
||||
constructor(activityData: ActivityModelType, createTime: number) {
|
||||
this.activityId = activityData.activityId;
|
||||
this.delayDay = activityData.delayDay ? activityData.delayDay : 0;
|
||||
@@ -34,6 +53,7 @@ export abstract class ActivityBase {
|
||||
this.todayIndex = deltaDays(moment(this.beginTime).toDate(), new Date) + 1;
|
||||
this.roundIndex = 1;
|
||||
this.nextRefreshTime = this.endTime;
|
||||
this.name = activityData.name;
|
||||
|
||||
this.type = activityData.type;
|
||||
console.log('今天是活动第几天', activityData.beginTime, new Date, this.todayIndex)
|
||||
|
||||
@@ -138,7 +138,10 @@ export class FirstGiftData extends ActivityBase {
|
||||
}
|
||||
|
||||
public getShowResult() {
|
||||
return pick(this, 'list');
|
||||
return {
|
||||
...this.getBaseKeys(),
|
||||
list: this.list,
|
||||
}
|
||||
}
|
||||
|
||||
constructor(activityData: ActivityModelType, createTime: number) {
|
||||
|
||||
@@ -171,7 +171,12 @@ export class LuckyTurntableData extends ActivityBase {
|
||||
|
||||
public getShowResult() {
|
||||
return {
|
||||
...pick(this, ['cost', 'freeCount', 'todayCount', 'count', 'box']),
|
||||
...this.getBaseKeys(),
|
||||
cost: this.cost,
|
||||
freeCount: this.freeCount,
|
||||
todayCount: this.todayCount,
|
||||
count: this.count,
|
||||
box: this.box,
|
||||
pool: this.pool.map(pool => pool.getShowResult()),
|
||||
records: this.records.map(record => [record.roleName, record.gid, record.count])
|
||||
}
|
||||
|
||||
91
shared/domain/activityField/timeLimitRankField.ts
Normal file
91
shared/domain/activityField/timeLimitRankField.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
import { pick } from 'underscore';
|
||||
import { RANK_TYPE } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityTurntableModelType, TurntableRecord } from '../../db/ActivityTurntableRec';
|
||||
import { RewardInter } from '../../pubUtils/interface';
|
||||
import { getRandEelmWithWeight, parseGoodStr } from '../../pubUtils/util';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
interface TimeLimitRewardInDb {
|
||||
rank: number; // 第几名
|
||||
rewards: string; // type&id&count
|
||||
}
|
||||
|
||||
interface TimeLimitInDb {
|
||||
rankType: number; // 排行榜类型
|
||||
hid: number; // 如果有单个武将排行,这里写武将id
|
||||
rankEndTime: number; // 排行榜统计结束时间。13位时间戳,之后会在后台加时间筛选,在此之前先找wo
|
||||
sendMailTime: number; // 发送奖励时间。13位时间戳
|
||||
rankRewards: TimeLimitRewardInDb[]; // 不同排名的奖励
|
||||
tabName: string; // 排行榜标签名
|
||||
}
|
||||
|
||||
|
||||
export class TimeLimitRankReward {
|
||||
rank: number
|
||||
rewards: string;
|
||||
|
||||
constructor(data: TimeLimitRewardInDb) {
|
||||
this.rank = data.rank;
|
||||
this.rewards = data.rewards;
|
||||
}
|
||||
}
|
||||
|
||||
// 新云转盘活动数据
|
||||
export class TimeLimitRankData extends ActivityBase {
|
||||
rankType: number; // 排行榜类型
|
||||
hid: number; // 如果有单个武将排行,这里写武将id
|
||||
rankEndTime: number; // 排行榜统计结束时间。13位时间戳,之后会在后台加时间筛选,在此之前先找wo
|
||||
sendMailTime: number; // 发送奖励时间。13位时间戳
|
||||
rankRewards: TimeLimitRankReward[] = []; // 不同排名的奖励
|
||||
tabName: string; // 标签名
|
||||
|
||||
// 是否可以记录
|
||||
public canRecord() {
|
||||
return this.beginTime <= Date.now() && this.rankEndTime >= Date.now();
|
||||
}
|
||||
|
||||
public getRewardByRank(rank: number) {
|
||||
let result: TimeLimitRankReward;
|
||||
for(let reward of this.rankRewards) {
|
||||
if(reward.rank > rank) break;
|
||||
result = reward;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public needSnapshot() {
|
||||
switch(this.rankType) {
|
||||
case RANK_TYPE.GUILD_FUND:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public initData(data: string) {
|
||||
let dataObj: TimeLimitInDb = JSON.parse(data);
|
||||
this.rankType = dataObj.rankType;
|
||||
this.hid = dataObj.hid;
|
||||
this.rankEndTime = dataObj.rankEndTime;
|
||||
this.sendMailTime = dataObj.sendMailTime;
|
||||
for(let rank of dataObj.rankRewards) {
|
||||
this.rankRewards.push(new TimeLimitRankReward(rank));
|
||||
}
|
||||
this.tabName = dataObj.tabName;
|
||||
}
|
||||
|
||||
public getShowResult() {
|
||||
return {
|
||||
...this.getBaseKeys(),
|
||||
rankType: this.rankType,
|
||||
rankEndTime: this.rankEndTime,
|
||||
tabName: this.tabName,
|
||||
}
|
||||
}
|
||||
|
||||
constructor(activityData: ActivityModelType, createTime: number) {
|
||||
super(activityData, createTime)
|
||||
this.initData(activityData.data)
|
||||
}
|
||||
}
|
||||
@@ -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[]) {
|
||||
|
||||
@@ -15,13 +15,16 @@ export interface DicCentreBase {
|
||||
readonly peopleNum: number;
|
||||
// 管理员人数
|
||||
readonly managerNum: number;
|
||||
// 每日最大可获得资金
|
||||
readonly maxFund: number;
|
||||
}
|
||||
|
||||
const DicCenterKeys: KeysEnum<DicCentreBase> = {
|
||||
id: true,
|
||||
level: true,
|
||||
peopleNum: true,
|
||||
managerNum: true
|
||||
managerNum: true,
|
||||
maxFund: true,
|
||||
};
|
||||
|
||||
// 炼器堂
|
||||
@@ -183,6 +186,7 @@ export function loadStructure() {
|
||||
arrCenter.forEach(o => {
|
||||
setStructureConsume(o);
|
||||
if(o.peopleNum > maxMemberCnt.max) maxMemberCnt.max = o.peopleNum;
|
||||
o.maxFund = o.feeLimit;
|
||||
dicCenterBase.set(o.level, _.pick(o, Object.keys(DicCenterKeys)));
|
||||
});
|
||||
arrCenter = undefined;
|
||||
|
||||
30
shared/resource/jsons/dic_army_structureCentre.json
Executable file → Normal file
30
shared/resource/jsons/dic_army_structureCentre.json
Executable file → Normal file
@@ -7,7 +7,8 @@
|
||||
"managerNum": 3,
|
||||
"consume": 100000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 10000
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
@@ -17,7 +18,8 @@
|
||||
"managerNum": 3,
|
||||
"consume": 250000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 20000
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
@@ -27,7 +29,8 @@
|
||||
"managerNum": 3,
|
||||
"consume": 700000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 30000
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
@@ -37,7 +40,8 @@
|
||||
"managerNum": 4,
|
||||
"consume": 1600000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 40000
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
@@ -47,7 +51,8 @@
|
||||
"managerNum": 4,
|
||||
"consume": 3400000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 50000
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
@@ -57,7 +62,8 @@
|
||||
"managerNum": 4,
|
||||
"consume": 7000000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 60000
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
@@ -67,7 +73,8 @@
|
||||
"managerNum": 5,
|
||||
"consume": 12250000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 70000
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
@@ -77,7 +84,8 @@
|
||||
"managerNum": 5,
|
||||
"consume": 18250000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 80000
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
@@ -87,7 +95,8 @@
|
||||
"managerNum": 5,
|
||||
"consume": 27250000,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 90000
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
@@ -97,6 +106,7 @@
|
||||
"managerNum": 5,
|
||||
"consume": 99999999,
|
||||
"buildWords": "&",
|
||||
"imageName": "jttubiao_1"
|
||||
"imageName": "jttubiao_1",
|
||||
"feeLimit": 100000
|
||||
}
|
||||
]
|
||||
@@ -145,5 +145,26 @@
|
||||
"sendName": "&",
|
||||
"content": "亲爱的小将军,以下是您未领取的【月卡】每日奖励,请查收",
|
||||
"time": 24
|
||||
},
|
||||
{
|
||||
"id": 21,
|
||||
"title": "&",
|
||||
"sendName": "&",
|
||||
"content": "您的名称不合规则,已修改为默认名,这是您的补偿",
|
||||
"time": 24
|
||||
},
|
||||
{
|
||||
"id": 22,
|
||||
"title": "&",
|
||||
"sendName": "&",
|
||||
"content": "您军团的名称不合规则,已修改为默认名",
|
||||
"time": 24
|
||||
},
|
||||
{
|
||||
"id": 23,
|
||||
"title": "&",
|
||||
"sendName": "&",
|
||||
"content": "您在限时排行%d中达到第%d名,可获得以下奖励",
|
||||
"time": 720
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user