邮件 活跃度下发

This commit is contained in:
mamengke01
2021-02-05 11:45:07 +08:00
parent 871e71ab54
commit 286eb231a6
36 changed files with 1183 additions and 439 deletions

View File

@@ -21,7 +21,7 @@ import * as redLockService from './app/services/redLockService';
// TODO 需要整理。
import _pinus = require('pinus');
import { updateTeamStatus } from './app/services/comBattleService';
import { init } from './app/pubUtils/gmData/gmDataUtil';
const filePath = (_pinus as any).FILEPATH;
filePath.MASTER = '/config/master';
filePath.SERVER = '/config/servers';
@@ -110,6 +110,15 @@ app.configure('production|development|alpha|dev', 'gate', function () {
});
});
app.configure('production|development|alpha|dev', 'gm', function () {
app.set('connectorConfig',
{
connector: pinus.connectors.hybridconnector,
useProtobuf: true
});
init();//将gm后台数据加载到gate服
});
app.configure('production|development|alpha|dev', 'systimer', function () {
app.set('connectorConfig',
{

View File

@@ -1,6 +1,6 @@
import {Application, RouteRecord, FrontendOrBackendSession, HandlerCallback} from "pinus";
import {checkEvent, getCurrentTime} from '../../../services/eventSercive';
import {checkEvent} from '../../../services/eventSercive';
import { refresh } from '../../../services/refreshService';
module.exports = function(app: Application) {
return new Filter(app);
}
@@ -15,7 +15,7 @@ Filter.prototype.before = function (routeRecord: RouteRecord, msg: any, session:
};
Filter.prototype.after = function (err: Error, routeRecord: RouteRecord, msg: any, session: FrontendOrBackendSession, resp: any, next: HandlerCallback) {
getCurrentTime(session);
refresh(session);
return checkEvent(session).then(()=>{
next(err);
}).catch(e => {

View File

@@ -11,6 +11,7 @@ import { CHAT_SERVER } from '../../../consts';
import { getDonation } from '../../../services/donateService';
import { getUserGuildWithRefActive } from '../../../services/guildService';
import { ARMY } from '../../../pubUtils/dicParam';
import { addActive } from '../../../services/guildService'
export default function(app: Application) {
return new DonationHandler(app);
}
@@ -59,6 +60,8 @@ export class DonationHandler {
//增加基金
const { fund } = await GuildModel.updateInfo(code, {}, { fund: rewardFund }, 'fund');
this.app.rpc.chat.guildRemote.updateInfo.toServer(CHAT_SERVER, code, { fund });
await addActive(roleId, serverId, 1, id);
return resResult(STATUS.SUCCESS, { donateFund, reports, donateCnt, goods });
}

View File

@@ -1,18 +1,20 @@
import { Application, BackendSession, pinus } from 'pinus';
import { Application, BackendSession } from 'pinus';
import { resResult, genCode, getRandomByLen } from '../../../pubUtils/util';
import { STATUS } from '../../../consts';
import { BossInstanceModel } from '../../../db/BossInstance';
import { BattleRecordModel } from '../../../db/BattleRecord';
import { nowSeconds, getTodayZeroPoint } from '../../../pubUtils/timeUtil';
import { getBossInstanceInfo, bossResult, checkMemberExists, pushBossHpMessage, getBossInstanceWhenEnd, addBossInstance } from '../../../services/guildBossService';
import { findWhere, random } from 'underscore'
import { GUILD_DATA_NAME, GUILD_STRUCTURE } from '../../../consts/constModules/guildConst';
import { findWhere } from 'underscore'
import { GUILD_STRUCTURE } from '../../../consts/constModules/guildConst';
import { DATA_NAME } from '../../../consts/dataName';
import { UserGuildModel } from '../../../db/UserGuild';
import { GUILD_OPERATE } from '../../../consts';
import { checkAuth, addActive } from '../../../services/guildService';
import { GuildModel } from '../../../db/Guild';
import { getBossByLv } from '../../../pubUtils/data';
import { lockData } from '../../../services/redLockService';
import { handleCost } from '../../../services/rewardService';
export default function (app: Application) {
return new GuildHandler(app);
@@ -59,6 +61,8 @@ export class GuildHandler {
//开启演武场
async openBossInstance(msg: {}, session: BackendSession) {
const roleId: string = session.get('roleId');
const sid: string = session.get('sid');
const serverId: number = parseInt(session.get('serverId'));
let userGuild = await UserGuildModel.getMyGuild(roleId, 'auth guildCode');
if (!userGuild)
@@ -66,7 +70,7 @@ export class GuildHandler {
const { guildCode: code } = userGuild;
const checkMyResult = await checkAuth(GUILD_OPERATE.OPEN_BOSS, roleId, null, userGuild);
if(!checkMyResult) return resResult(STATUS.GUILD_AUTH_NOT_ENOUGH);
let res:any = await lockData(serverId, GUILD_DATA_NAME.BOSS_SCRIPT, code);//加锁
let res:any = await lockData(serverId, DATA_NAME.BOSS_SCRIPT, code);//加锁
if (!!res.err)
return resResult(STATUS.REDLOCK_ERR);
let bossInstance = await BossInstanceModel.findBossInstance(code);
@@ -83,14 +87,13 @@ export class GuildHandler {
return resResult(STATUS.GUILD_STRUCTURE_NOT_FOUND);
}
let bossBase = getBossByLv(curStructure.lv);
//消耗TODO
let {bossHp, warId, bossLevel } = getRandomByLen(bossBase.wars);
let resGuild = await GuildModel.costFund(code, bossBase.consume)
let { bossHp, warId } = getRandomByLen(bossBase.wars);
let resGuild = await GuildModel.costFund(code, bossBase.opencost);
if (!resGuild)
return resResult(STATUS.GUILD_FUND_NOT_ENOUGH);
await BossInstanceModel.openBossInstance(code, bossHp, warId, bossLevel);
await BossInstanceModel.openBossInstance(code, bossHp, warId, bossBase.bossLevel);
res.releaseCallback();
let result = {warId, ranks: [], myRank: {}, bossHp, status: 3, bossLv: bossLevel, isBattled: false};
let result = {warId, ranks: [], myRank: {}, bossHp, status: 3, bossLv: bossBase.bossLevel, isBattled: false};
return resResult(STATUS.SUCCESS, result);
}
@@ -111,14 +114,10 @@ export class GuildHandler {
return resResult(STATUS.GUILD_SCRIPT_IS_BATTLED);
let { warId, ranks } = bossInstance;
const battleCode = genCode(8); // 关卡唯一值
//TODO查看地图字典
let warInfo;
await BattleRecordModel.updateBattleRecordByCode(battleCode, {
$set: {
roleId, roleName, battleId: warId,
status: 0,
// warName: warInfo.gk_name,
// warType: warInfo.warType,
record: { heroes:[],recordNum: bossInstance.num, bossHp: bossInstance.bossHp},
}
}, true);
@@ -147,7 +146,7 @@ export class GuildHandler {
//记录伤害
let bossInstance = await BossInstanceModel.updateBossHp(code, damage, roleId);
if (!bossInstance) {//进入结算
let flag = await bossResult(code, serverId, GUILD_DATA_NAME.BOSS_SCRIPT, roleId, damage);
let flag = await bossResult(code, serverId, DATA_NAME.BOSS_SCRIPT, roleId, damage);
if (!flag) {
return resResult(STATUS.WRONG_PARMS);
}

View File

@@ -1,6 +1,6 @@
import { Application, BackendSession, pinus, ChannelService } from 'pinus';
import { resResult, getRandEelm, getRefTime } from '../../../pubUtils/util';
import { STATUS, GUILD_OPERATE, GUILD_AUTH, GUILD_JOB, GUILD_APPLY_TYPE, GUILD_STRUCTURE, GUILD_REC_TYPE, GUILD_STRUCTURE_NAME, MAIL_TYPE, REDIS_KEY, GUILD_DATA_NAME, CHAT_SERVER } from '../../../consts';
import { STATUS, GUILD_OPERATE, GUILD_AUTH, GUILD_JOB, GUILD_APPLY_TYPE, GUILD_STRUCTURE, GUILD_REC_TYPE, GUILD_STRUCTURE_NAME, MAIL_TYPE, REDIS_KEY, CHAT_SERVER } from '../../../consts';
import { UserGuildModel } from '../../../db/UserGuild';
import { checkAuth, joinGuild, getGuildWithRefActive, getUserGuildWithRefActive, addActive, settleGuildWeekly } from '../../../services/guildService';
import { GuildModel, GuildType } from '../../../db/Guild';
@@ -17,7 +17,7 @@ import { GuildRecModel } from '../../../db/GuildRec';
import { sendMail } from '../../../services/mailService';
import { existsRank, initSingleRankWithServer, getRank, setRank, redisUserInfoUpdate, redisUserInfoAdd, removeFromRank, getMyRank, isRoleOnline } from '../../../services/redisService';
import { lockData } from '../../../services/redLockService';
import { DATA_NAME } from '../../../consts/dataName';
import { openGuildRefine } from '../../../services/guildRefineService';
import { unlockTrain } from '../../../services/guildTrainService';
export default function (app: Application) {
@@ -713,7 +713,7 @@ export class GuildHandler {
const checkResult = await checkAuth(GUILD_OPERATE.UP_STRUCTURE, roleId, code);
if (!checkResult) return resResult(STATUS.GUILD_AUTH_NOT_ENOUGH);
let res:any = await lockData(serverId, GUILD_DATA_NAME.UP_STRUCTURE, code);// 加锁
let res:any = await lockData(serverId, DATA_NAME.UP_STRUCTURE, code);// 加锁
if (!!res.err) return resResult(STATUS.REDLOCK_ERR);
const guild = await GuildModel.findByCode(code, serverId, 'lv structure');

View File

@@ -9,11 +9,12 @@ import { handleCost, addItems, checkGoods } from '../../../services/rewardServic
import { GuildModel } from '../../../db/Guild';
import { findIndex, findWhere } from 'underscore';
import { lockData } from '../../../services/redLockService';
import { GUILD_DATA_NAME, GUILD_STRUCTURE } from '../../../consts/constModules/guildConst';
import { checkAuth } from '../../../services/guildService';
import { ARMY } from '../../../pubUtils/dicParam';
import { CURRENCY_BY_TYPE, CURRENCY_TYPE } from '../../../consts/constModules/itemConst';
import { openGuildRefine } from '../../../services/guildRefineService';
import { DATA_NAME } from '../../../consts/dataName';
export default function (app: Application) {
return new GuildRefineHandler(app);
}
@@ -80,7 +81,7 @@ export class GuildRefineHandler {
let developConsume = getArmyDevelopConsumeById(id);
if (!developConsume)
return resResult(STATUS.WRONG_PARMS);
let res:any = await lockData(serverId, GUILD_DATA_NAME.GUILD_REFINE, code);//加锁
let res:any = await lockData(serverId, DATA_NAME.GUILD_REFINE, code);//加锁
if (!!res.err)
return resResult(STATUS.REDLOCK_ERR);
let guildRefine = await GuildRefineModel.getRefine(code);
@@ -115,7 +116,7 @@ export class GuildRefineHandler {
if (!userGuild)
return resResult(STATUS.WRONG_PARMS);
const { guildCode: code } = userGuild;
let res:any = await lockData(serverId, GUILD_DATA_NAME.GUILD_ASSIST_REFINE, code);//加锁
let res:any = await lockData(serverId, DATA_NAME.GUILD_ASSIST_REFINE, code);//加锁
if (!!res.err)
return resResult(STATUS.REDLOCK_ERR);
let guildRefine = await GuildRefineModel.getRefine(code);

View File

@@ -7,7 +7,7 @@ import { nowSeconds, getHourPoint, getCurHourPoint } from '../../../pubUtils/tim
import { getUserGuild, getGuildTrainInfo, unlockTrain, resetTrain, getGuildTrainRewards} from '../../../services/guildTrainService';
import { findIndex, findWhere, indexBy } from 'underscore'
import { lockData } from '../../../services/redLockService';
import { GUILD_DATA_NAME, REFRESH_HOUR, GUILD_REPORT_NUM } from '../../../consts/constModules/guildConst';
import { REFRESH_HOUR, GUILD_REPORT_NUM } from '../../../consts/constModules/guildConst';
import { UserGuildModel } from '../../../db/UserGuild';
import { GuildModel } from '../../../db/Guild';
import { getArmyTrainJuDian, getTrainSoloReward, getTrainBaseByLv } from '../../../pubUtils/data';
@@ -16,6 +16,8 @@ import { handleCost, addItems } from '../../../services/rewardService';
import { ARMY } from '../../../pubUtils/dicParam';
import { addActive } from '../../../services/guildService';
import { GuildTrainReportModel } from '../../../db/GuildTrainReport';
import { DATA_NAME } from '../../../consts/dataName';
export default function (app: Application) {
return new GuildTrainHandler(app);
}
@@ -168,7 +170,7 @@ export class GuildTrainHandler {
let trainId = battleRecord.record.trainId;
let hid = battleRecord.record.hid;
let res:any = await lockData(serverId, GUILD_DATA_NAME.TRAIN, code + '_' + trainId);//加锁
let res:any = await lockData(serverId, DATA_NAME.TRAIN, code + '_' + trainId);//加锁
if (!!res.err)
return resResult(STATUS.REDLOCK_ERR);
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId);
@@ -249,7 +251,7 @@ export class GuildTrainHandler {
return resResult(STATUS.WRONG_PARMS);
const { guildCode: code } = userGuild;
let { trainLv } = await GuildModel.findGuild(code, serverId, 'structure');
let res:any = await lockData(serverId, GUILD_DATA_NAME.TRAIN_BOX, code + '_' + trainId);//加锁
let res:any = await lockData(serverId, DATA_NAME.TRAIN_BOX, code + '_' + trainId);//加锁
if (!!res.err)
return resResult(STATUS.REDLOCK_ERR);

View File

@@ -18,6 +18,7 @@ import { UserGuildModel } from '../../../db/UserGuild';
import { GuildModel } from '../../../db/Guild';
import { gameData } from '../../../pubUtils/data';
import { getMails } from '../../../services/mailService';
export default function (app: Application) {
return new EntryHandler(app);
}
@@ -56,6 +57,7 @@ export class EntryHandler {
await session.abind(role.roleId);
session.set('uid', role.roleId);
session.set('roleId', role.roleId);
session.set('updatedMailAt', role.updatedMailAt);
session.set('roleName', role.roleName);
session.set('eventStatus', role.eventStatus);
session.set('sid', self.app.get('serverId'));
@@ -89,7 +91,7 @@ export class EntryHandler {
let heros = await HeroModel.findByRole(role.roleId, [], HERO_SELECT.ENTRY, true);
let equips = await EquipModel.findbyRole(role.roleId);
let items = await ItemModel.findbyRole(role.roleId);
let mails = await getMails(role.roleId, serverId)
await chackFunOpenWhenLogin(role, session);
await loginRefresh(role.roleId);
@@ -98,6 +100,9 @@ export class EntryHandler {
role['consumeGoods'] = items;
let apJson = await getAp(Date.now(), role.roleId);
role['apJson'] = apJson;
role['ce'] = reduceCe(role.ce);
role['topFiveCe'] = reduceCe(role.topFiveCe);
role['mails'] = mails;
if(role.hasGuild) {
let userGuild = await UserGuildModel.getMyGuild(role.roleId, USER_GUILD_SELECT.ENTRY );

View File

@@ -0,0 +1,20 @@
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
import { setGmMails, getGmMailById, getGmMails } from '../../../pubUtils/gmData/gmDataUtil';
import { MAIL_TYPE, MAIL_TEM_TYPE } from "../../../consts/constModules/mailConst";
import { mailData } from "../../../pubUtils/interface";
import { getContent } from '../../../services/mailService';
import { findWhere } from 'underscore';
export default function (app: Application) {
return new GateRemote(app);
}
export class GateRemote {
constructor(private app: Application) {
this.app = app;
this.channelService = app.get('channelService');
}
private channelService: ChannelService;
}

View File

@@ -1,11 +1,11 @@
import {Application, BackendSession} from 'pinus';
import {Application, BackendSession, pinus} from 'pinus';
import { RoleModel } from '../../../db/Role';
import { EventRecordModel } from '../../../db/EventRecord';
import { getEvent } from '../../../services/eventSercive';
import { resResult } from '../../../pubUtils/util';
import { STATUS } from '../../../consts/statusCode';
import { GMMailModel } from '../../../db/GMMail';
import { setGmMails } from '../../../pubUtils/gmData/gmDataUtil';
export default function(app: Application) {
return new GmHandler(app);
}
@@ -70,7 +70,6 @@ export class GmHandler {
channel.add(roleId, sid);
}
let tsid = channel.getMember(roleId)['sid'];
channelService.pushMessageByUids(eventName, resResult(STATUS.SUCCESS, content), [{
uid: roleId,
@@ -78,4 +77,10 @@ export class GmHandler {
}]);
return resResult(STATUS.SUCCESS, { msg: content });
}
async addMail(msg: { endTime: number, serverId: number, sendName: string, content: string, goods, sendRoles:[{roleId: string, status: number}], gmMailType: number, sendTime: number, }) {
let {sendRoles, endTime, content, sendName, gmMailType, sendTime, goods, serverId} = msg;
let mail = await GMMailModel.addMail({serverId, sendRoles, sendName, endTime, content, gmMailType, sendTime, goods});
setGmMails([mail]);
}
}

View File

@@ -1,9 +1,13 @@
import { Application, ChannelService, FrontendSession, RemoterClass } from 'pinus';
import { Application, ChannelService } from 'pinus';
import { resResult } from '../../../pubUtils/util';
import { STATUS } from '../../../consts';
import { setGmMails, getGmMailById, getGmMails } from '../../../pubUtils/gmData/gmDataUtil';
import { MAIL_TYPE, MAIL_TEM_TYPE } from "../../../consts/constModules/mailConst";
import { mailData } from "../../../pubUtils/interface";
import { getContent } from '../../../services/mailService';
import { findWhere } from 'underscore';
export default function (app: Application) {
return new ChatRemote(app);
return new GMRemote(app);
}
// rpc 定义挪到单独的定义文件(user.rpc.define.ts)。解决ts-node 有可能找不到定义的问题。
@@ -13,11 +17,11 @@ export default function (app: Application) {
// declare global {
// interface UserRpc {
// chat: {
// chatRemote: RemoterClass<FrontendSession, ChatRemote>;
// GMRemote: RemoterClass<FrontendSession, GMRemote>;
// };
// }
// }
export class ChatRemote {
export class GMRemote {
constructor(private app: Application) {
this.app = app;
@@ -91,4 +95,47 @@ export class ChatRemote {
};
channel.pushMessage('onLeave', resResult(STATUS.SUCCESS, param));
}
public async refreshGmMails(mails:[any]) {
setGmMails(mails);
}
public async getMailInfos(roleId: string, serverId: number, mails: [any], groupMails: [any]) {
let list: mailData[] = [];
mails.map(async function({ mailId, goods, sendTime, params, status, _id, mailTemType, sendName, endTime}) {
if (mailTemType == MAIL_TEM_TYPE.GAMEMAIL) { //模板邮件
let { content } = getContent(parseInt(mailId), params);
if (!content)
return;
list.push({ id: _id, mailId, goods, sendTime, endTime, content, status, mailType: MAIL_TYPE.SINGLEMAIL, sendName });
} else if (mailTemType == MAIL_TEM_TYPE.GMTYPE) { //系统邮件
let gmMail = getGmMailById(mailId, serverId);
if (!gmMail)
return;
let { goods, sendTime, content, endTime, sendName } = gmMail;
list.push({ id: _id, mailId, goods, sendTime, endTime, content, status, mailType: MAIL_TYPE.SINGLEMAIL, sendName });
}
});
groupMails.map(async function({ mailId, goods, sendTime, endTime, params, sendRoles, _id, mailTemType, sendName }) {
let { status } = findWhere(sendRoles, {roleId});
if (mailTemType == MAIL_TEM_TYPE.GAMEMAIL) { //模板邮件
let { content } = getContent( parseInt(mailId), params);
if (!content)
return;
list.push({ id: _id, mailId, goods, sendTime, content, endTime, status, mailType: MAIL_TYPE.GROUPMAIL, sendName });
} else if (mailTemType == MAIL_TEM_TYPE.GMTYPE) { //系统邮件
let gmMail = getGmMailById(mailId, serverId);
if (!gmMail)
return;
let { goods, sendTime, content, endTime, sendName } = gmMail;
list.push({ id: _id, mailId, goods, sendTime, endTime, content, status, mailType: MAIL_TYPE.GROUPMAIL, sendName });
}
});
return list;
}
public async getMails(updatedMailAt: number, serverId: number) {
let gmMails = getGmMails(updatedMailAt, serverId);
return gmMails;
}
}

View File

@@ -1,7 +1,7 @@
import {Application, BackendSession, ChannelService} from 'pinus';
import { handleCost, addItems } from '../../../services/rewardService';
import { calPlayerCeAndSave } from '../../../services/playerCeService';
import { resResult, returnHeroCeRatio, getAllAttrStage } from '../../../pubUtils/util';
import { resResult, returnHeroCeRatio } from '../../../pubUtils/util';
import { STATUS } from '../../../consts/statusCode';
import {HeroModel} from '../../../db/Hero';
import {CURRENCY_BY_TYPE, CURRENCY_TYPE, CONSUME_TYPE, HERO_GROW_MAX, HERO_SYSTEM_TYPE, ITID, ABI_STAGE, HERO_CE_RATIO} from '../../../consts';

View File

@@ -0,0 +1,132 @@
import {Application, BackendSession, ChannelService} from 'pinus';
import { MailModel } from '../../../db/Mail';
import { GroupMailModel } from '../../../db/GroupMail';
import { resResult } from '../../../pubUtils/util';
import { STATUS } from '../../../consts/statusCode';
import { findWhere } from 'underscore';
import { MAIL_STATUS, MAIL_TEM_TYPE, MAIL_TYPE } from '../../../consts/constModules/mailConst';
import { handleCost, addItems } from '../../../services/rewardService';
import { getGmMailById } from '../../../pubUtils/gmData/gmDataUtil';
export default function(app: Application) {
return new RoleHandler(app);
}
export class RoleHandler {
constructor(private app: Application) {
}
public async refrshMails(msg:{}) {
}
public async readMail(msg: { id: string, mailType: number }, session: BackendSession) {
let roleId: string = session.get('roleId');
let { id, mailType } = msg;
let mail;
if (mailType == MAIL_TYPE.SINGLEMAIL) {
mail = await MailModel.updateMailByStatus(id, [MAIL_STATUS.CREATE], { status: MAIL_STATUS.READ });
} else if (mailType == MAIL_TYPE.GROUPMAIL) {
mail = await GroupMailModel.updateMailByStatus(id, roleId, MAIL_STATUS.READ, [MAIL_STATUS.CREATE]);
}
if (!mail)
return resResult(STATUS.WRONG_PARMS);
return resResult(STATUS.SUCCESS, { mails: [{ id, status: MAIL_STATUS.READ, mailType }] });
}
public async delMails(msg: { id: string, mailType: number, type: number }, session: BackendSession) {
let roleId: string = session.get('roleId');
let { id, type, mailType } = msg;
if (type == 1) {//单个删除
if (mailType == MAIL_TYPE.SINGLEMAIL) {
let mail = await MailModel.delMail(id);
if (!mail)
return resResult(STATUS.WRONG_PARMS);
return resResult(STATUS.SUCCESS, { mails: [{ id, status: MAIL_STATUS.DELETE, mailType }] });
} else if (mailType == MAIL_TYPE.GROUPMAIL) {
let mail = await GroupMailModel.delMail(id, roleId);
if (!mail)
return resResult(STATUS.WRONG_PARMS);
return resResult(STATUS.SUCCESS, { mails: [{ id, status: MAIL_STATUS.DELETE, mailType }] });
} else {
return resResult(STATUS.WRONG_PARMS);
}
} else {//一键删除
let groupMailIds = await GroupMailModel.findReadAndRewardsMails(roleId);
await GroupMailModel.updateMailStatus(groupMailIds, MAIL_STATUS.DELETE, roleId);
let mailIds = await MailModel.findReadAndRewardsMails(roleId);
await MailModel.updateMailStatus(mailIds, MAIL_STATUS.DELETE);
let mails = [];
groupMailIds.map((id)=>{
mails.push({id, status: MAIL_STATUS.DELETE, mailType: MAIL_TYPE.GROUPMAIL});
});
mailIds.map((id)=>{
mails.push({id, status: MAIL_STATUS.DELETE, mailType: MAIL_TYPE.SINGLEMAIL});
});
return resResult(STATUS.SUCCESS, { mails });
}
}
public async getMailRewards(msg: { id: string, mailType: number, type: number }, session: BackendSession) {
let roleId: string = session.get('roleId');
let roleName: string = session.get('roleName');
let sid: string = session.get('sid');
let serverId: number = session.get('serverId');
let { id, type, mailType } = msg;
let mailGoods = [];
let mails = [];
if (type == 1) {//单个领取
let mail;
if (mailType == MAIL_TYPE.SINGLEMAIL) {
mail = await MailModel.updateMailByStatus(id, [MAIL_STATUS.READ], { status: MAIL_STATUS.RECEIVED });
if (!mail)
return resResult(STATUS.WRONG_PARMS);
} else if (mailType == MAIL_TYPE.GROUPMAIL) {
mail = await GroupMailModel.updateMailByStatus(id, roleId, MAIL_STATUS.RECEIVED, [MAIL_STATUS.READ]);
if (!mail)
return resResult(STATUS.WRONG_PARMS);
} else {
return resResult(STATUS.WRONG_PARMS);
}
mails.push({id, status: MAIL_STATUS.DELETE, mailType});
if (mail.mailTemType == MAIL_TEM_TYPE.GMTYPE) {
let gmMail = getGmMailById(id, serverId);
mailGoods.push(...gmMail.goods);
} else {
mailGoods.push(...mail.goods);
}
} else {//一键领取
let ids;
let groupMailRewards = await GroupMailModel.findRewardsMails(roleId);
ids = groupMailRewards.map(({_id, goods, mailTemType})=>{
if (mailTemType == MAIL_TEM_TYPE.GMTYPE) {
let gmMail = getGmMailById(id, serverId);
mailGoods.push(...gmMail.goods);
} else {
mailGoods.push(...goods);
}
mails.push({id: _id, status: MAIL_STATUS.DELETE, mailType: MAIL_TYPE.GROUPMAIL});
return _id;
});
if (!!ids.length)
await GroupMailModel.updateMailStatus(ids, MAIL_STATUS.RECEIVED, roleId);
let mailRewards = await MailModel.findRewardsMails(roleId);
ids = mailRewards.map(({_id, goods, mailTemType})=>{
if (mailTemType == MAIL_TEM_TYPE.GMTYPE) {
let gmMail = getGmMailById(id, serverId);
mailGoods.push(...gmMail.goods);
} else {
mailGoods.push(...goods);
}
mails.push({id, status: MAIL_STATUS.DELETE, mailType: MAIL_TYPE.SINGLEMAIL});
return _id;
});
if (!!ids.length)
await MailModel.updateMailStatus(ids, MAIL_STATUS.RECEIVED);
}
let resGoods = [];
if (!!mailGoods && !!mailGoods.length)
resGoods = await addItems(roleId, roleName, sid, mailGoods);
return resResult(STATUS.SUCCESS, { mails, goods: resGoods });
}
}

View File

@@ -9,7 +9,7 @@ import { BattleRemote } from './battle/remote/battleRemote';
import { ConnectorRemote } from './connector/remote/connectorRemote';
import { SystimerRemote } from './systimer/remote/systimerRemote';
import { GuildRemote } from './chat/remote/guildRemote';
import { GMRemote } from './gm/remote/gmRemote';
declare global {
interface UserRpc {
chat: {
@@ -25,6 +25,9 @@ declare global {
};
systimer: {
systimerRemote: RemoterClass<FrontendSession, SystimerRemote>;
},
gm: {
gmRemote: RemoterClass<FrontendSession, GMRemote>;
}
}
}

View File

@@ -408,9 +408,3 @@ export function checkQuiz(id: number, answer: number) {
}
}
export function getCurrentTime(session: FrontendOrBackendSession) {
let roleId = session.get('roleId');
let sid = session.get('sid');
let uids = [{uid: roleId, sid}];
pinus.app.get('channelService').pushMessageByUids('onPushCurrentTime', resResult(STATUS.SUCCESS, {time: Date.now()}), uids);
}

View File

@@ -11,6 +11,7 @@ import { BattleRecordModel } from '../db/BattleRecord';
import { getArmyBossRank } from '../pubUtils/data';
import { getMailContent } from '../services/mailService';
import { pushMail } from '../pubUtils/interface';
import { MAIL_TYPE } from '../consts';
/**
*
* @param bossInstance
@@ -122,12 +123,12 @@ export async function bossResult(code: string, serverId: number, dataName: strin
});
let mails = new Array<MailType>();
let pushMessage = new Array<pushMail>();
recordRanks.forEach(async function({roleId, score}, index){
recordRanks.forEach(async function({ roleId }, index){
let rankLv = index + 1;
let goods = getArmyBossRankReward(rankLv);
if (!goods || !goods.length)
return;
await getMailContent(roleId, 1, [JSON.stringify(rankLv)], goods, mails, pushMessage);
await getMailContent(roleId, MAIL_TYPE.GUILD_BOSS_REWARD, [JSON.stringify(rankLv)], goods, mails, pushMessage);
});
await MailModel.addMails(mails);
pushMessage.forEach(({route, data, uids })=>{

View File

@@ -1,17 +1,4 @@
import { UserGuildModel } from '../db/UserGuild';
import { getArmyTrainJuDian, getArmyDevelopConsume } from '../pubUtils/data';
import { nowSeconds, getHourPoint } from '../pubUtils/timeUtil';
import { GUILD_REPORT_NUM, GUILD_DATA_NAME, REFRESH_HOUR } from '../consts/constModules/guildConst';
import { GuildTrainType, GuildTrainModel, TrainInstance } from '../db/GuildTrain';
import { GuildModel } from '../db/Guild';
import { findWhere } from 'underscore';
import { ARMY } from '../pubUtils/dicParam';
import { lockData } from './redLockService';
import { pinus } from 'pinus';
import { MailModel, MailType } from '../db/Mail';
import { getRandomByLen, resResult } from '../pubUtils/util';
import { getRedis } from './redisService';
import { STATUS } from '../consts/statusCode';
import { getArmyDevelopConsume } from '../pubUtils/data';
import { ScienceTree, GuildRefineModel } from '../db/GuildRefine';
export async function openGuildRefine(code: string) {
let developConsumes = getArmyDevelopConsume();

View File

@@ -1,7 +1,7 @@
import { gameData, getGuildActiveWeekReward, getGuildActiveByIdAndType } from "../pubUtils/data";
import { GuildModel, GuildType } from "../db/Guild";
import { resResult, shouldRefresh } from "../pubUtils/util";
import { STATUS, MAIL_TYPE, GUILD_AUTH, GUILD_JOB, REDIS_KEY, GUILD_DATA_NAME, } from "../consts";
import { STATUS, MAIL_TYPE, GUILD_AUTH, GUILD_JOB, REDIS_KEY, CHAT_SERVER } from "../consts";
import { RoleModel, RoleType } from "../db/Role";
import { UserGuildModel, UserGuildType } from "../db/UserGuild";
import { UserGuildApplyModel } from "../db/UserGuildApply";
@@ -18,6 +18,8 @@ import { ErrLogModel } from '../db/ErrLog';
import { MailType, MailModel } from '../db/Mail';
import { pushMail } from '../pubUtils/interface';
import { getMailContent } from '../services/mailService';
import { DATA_NAME } from '../consts/dataName';
/**
* @description 检查该玩家是否有权限做操作
* @param func 操作id
@@ -41,11 +43,11 @@ export async function checkAuth(func: number, roleId: string, code?: string, use
export async function joinGuild(code: string, guildName: string, lv: number, roleId: string, serverId: number) {
// 周结算锁
let isWeeklySum = await isLocked(serverId, GUILD_DATA_NAME.WEEKLY_GUILD_SUM, code);
let isWeeklySum = await isLocked(serverId, DATA_NAME.WEEKLY_GUILD_SUM, code);
if(isWeeklySum) return { status: 0, resResult: resResult(STATUS.GUILD_WEEKLY_SUM) };
// 人数锁
let res:any = await lockData(serverId, GUILD_DATA_NAME.JOIN_GUILD, code);// 加锁
let res:any = await lockData(serverId, DATA_NAME.JOIN_GUILD, code);// 加锁
if (!!res.err) return { status: 0, resResult: resResult(STATUS.REDLOCK_ERR) };
const result = await RoleModel.joinGuild(roleId, code, guildName);
@@ -86,7 +88,7 @@ export async function joinGuild(code: string, guildName: string, lv: number, rol
*/
export async function getGuildWithRefActive(guildCode: string, serverId: number) {
let res:any = await lockData(serverId, GUILD_DATA_NAME.REFRESH_ACTIVE, guildCode);// 加锁
let res:any = await lockData(serverId, DATA_NAME.REFRESH_ACTIVE, guildCode);// 加锁
if (!!res.err) return false;
let guild = await GuildModel.findByCode(guildCode, serverId, '+refTimeDaily');
@@ -135,7 +137,7 @@ export async function addActive(roleId: string, serverId: number, id: number, ty
if(!guild) return { status: 0, resResult: resResult(STATUS.GUILD_NOT_FOUND) };
// 周结算锁
let isWeeklySum = await isLocked(serverId, GUILD_DATA_NAME.WEEKLY_GUILD_SUM, guildCode);
let isWeeklySum = await isLocked(serverId, DATA_NAME.WEEKLY_GUILD_SUM, guildCode);
if(isWeeklySum) return { status: 0, resResult: resResult(STATUS.GUILD_WEEKLY_SUM) };
let {activeRecord} = userGuild;
@@ -159,6 +161,7 @@ export async function addActive(roleId: string, serverId: number, id: number, ty
let leader = await RoleModel.findById(guild.leader);
let guildRankParam = new GuildRankParam(guild.icon, guild.name, guild.lv, new GuildLeader(leader));
await setRank(REDIS_KEY.GUILD_ACTIVE_RANK, serverId, guild.code, guild.activeWeekly, guild.activeUpdateTime * 1000, guildRankParam);
pinus.app.rpc.chat.guildRemote.updateInfo.toServer(CHAT_SERVER, guildCode, { activeDaily: guild.activeDaily, activeWeekly: guild.activeWeekly });
return { status: 1, guild, userGuild };
}
@@ -176,17 +179,21 @@ export async function getUserGuildWithRefActive(roleId: string, select: string,
const now = new Date();
let isRefDaily = shouldRefresh(refTimeDaily, now, 0);
if(isRefDaily) {
let goods = wishGoods.map(({ goodId, drawCnt})=>{
return {id: goodId, count: drawCnt};
let goods = [];
wishGoods.map(({ goodId, drawCnt})=>{
if (drawCnt > 0)
goods.push({id: goodId, count: drawCnt});
});
let mails = new Array<MailType>();
let pushMessage = new Array<pushMail>();
await getMailContent(roleId, 1, [], goods, mails, pushMessage);
await MailModel.addMails(mails);
if (!notPush) {
pushMessage.forEach(({route, data, uids })=>{
pinus.app.channelService.pushMessageByUids(route, resResult(STATUS.SUCCESS, { mails:data }), uids);
});
if (!!goods.length) {
let mails = new Array<MailType>();
let pushMessage = new Array<pushMail>();
await getMailContent(roleId, MAIL_TYPE.WISH_POOL_REWARD, [], goods, mails, pushMessage);
await MailModel.addMails(mails);
if (!notPush) {
pushMessage.forEach(({route, data, uids })=>{
pinus.app.channelService.pushMessageByUids(route, resResult(STATUS.SUCCESS, { mails:data }), uids);
});
}
}
receivedActive = []; refTimeDaily = now; activeDaily = 0; activeRecord = []; wishGoods = [];
let receiveBoxs = [], wishDntCnt = 0, donateCnt = 0;
@@ -207,7 +214,7 @@ export async function settleGuildWeekly() {
// 周结算时1. 不能变动memberCnt 2.玩家activeWeekly不能变动 3.公会activeWeekly不能变动
for(let { code, memberCnt, serverId } of guildList) {
let res:any = await lockData(serverId, GUILD_DATA_NAME.WEEKLY_GUILD_SUM, code);//加锁
let res:any = await lockData(serverId, DATA_NAME.WEEKLY_GUILD_SUM, code);//加锁
if (!!res.err) {
await ErrLogModel.create(`settle guild lock data error: ${res.err}`)
}

View File

@@ -1,7 +1,7 @@
import { UserGuildModel } from '../db/UserGuild';
import { getArmyTrainJuDian, getTrainBaseByLv } from '../pubUtils/data';
import { nowSeconds, getHourPoint } from '../pubUtils/timeUtil';
import { GUILD_REPORT_NUM, GUILD_DATA_NAME, REFRESH_HOUR, GUILD_STRUCTURE } from '../consts/constModules/guildConst';
import { GUILD_REPORT_NUM, REFRESH_HOUR, GUILD_STRUCTURE } from '../consts/constModules/guildConst';
import { GuildTrainType, GuildTrainModel, TrainInstance } from '../db/GuildTrain';
import { GuildModel } from '../db/Guild';
import { findWhere } from 'underscore';
@@ -12,7 +12,11 @@ import { MailModel, MailType } from '../db/Mail';
import { getRandomByLen, resResult } from '../pubUtils/util';
import { getRedis } from './redisService';
import { STATUS } from '../consts/statusCode';
import { GuildTrainReportModel } from '../db/GuildTrainReport'
import { GuildTrainReportModel } from '../db/GuildTrainReport';
import { DATA_NAME } from '../consts/dataName';
import { getMailContent } from './mailService';
import { MAIL_TYPE } from '../consts';
export async function getUserGuild(roleId: string, serverId: number) {
let userGuild = await UserGuildModel.getMyGuild(roleId,'trainCount trainTime trainRewards guildCode');
if (!userGuild)
@@ -108,7 +112,7 @@ export async function unlockTrain(code: string, trainId: number) {
}
export async function resetTrain(code: string, serverId: number) {
let res:any = await lockData(serverId, GUILD_DATA_NAME.GUILD, code);//加锁
let res:any = await lockData(serverId, DATA_NAME.GUILD, code);//加锁
if (!!res.err)
return;
let { structure } = await GuildModel.findGuild(code, serverId, 'structure');
@@ -123,7 +127,6 @@ export async function resetTrain(code: string, serverId: number) {
const guildTrains = await GuildTrainModel.getGuildTrainBoxs(code);
let mails = new Array<MailType>();
let pushMessage = [];
let uids = [];
let { shilianRewardRatio } = getTrainBaseByLv(GUILD_STRUCTURE.TRAIN);
userGuildList.forEach(async function ({roleId, trainRewards}) {
@@ -145,22 +148,15 @@ export async function resetTrain(code: string, serverId: number) {
goods.push(...jinjieReward);
}
}
let key = 'login_roleId_' + roleId;
let sid = await getRedis(key);
if (!!goods.length) {
const doc = new MailModel();
const mail = Object.assign(doc.toJSON(), {roleId, goods, sendName: '系统', mailId: 1, sendTime: nowSeconds(), content:'练兵场未领取宝箱奖励和进阶奖励:'});
mails.push(mail);
if (!!sid) {
pushMessage.push({route: 'onMailsAdd', data:[mail], uid: roleId, sid});
}
}
if (!!sid) {
uids.push({ uid: roleId, sid});
if (!!goods.length) {
await getMailContent(roleId, MAIL_TYPE.GUILD_TRAIN_REWARD, [], goods, mails, pushMessage);
}
});
pinus.app.channelService.pushMessageByUids('onGuildTainReset', resResult(STATUS.SUCCESS, {}), uids);
await MailModel.addMails(mails);
pushMessage.forEach(({route, data, uids })=>{
pinus.app.channelService.pushMessageByUids(route, resResult(STATUS.SUCCESS, { mails:data }), uids);
pinus.app.channelService.pushMessageByUids('onGuildTainReset', resResult(STATUS.SUCCESS, {}), uids);
});
await GuildTrainModel.resetGuildTrain(code);
await unlockTrain(code, 1);
await UserGuildModel.resetTrainUserGuild(code);

View File

@@ -1,4 +1,4 @@
import { RewardInter, pushMail } from "../pubUtils/interface";
import { RewardInter, pushMail, mailData } from "../pubUtils/interface";
import { MailModel, MailType } from "../db/Mail";
import { getRedis } from "./redisService";
import { pinus } from "pinus";
@@ -6,34 +6,107 @@ import { gameData } from "../pubUtils/data";
import { nowSeconds } from '../pubUtils/timeUtil';
import { STATUS } from '../consts/statusCode';
import { resResult } from '../pubUtils/util';
import { GroupMailModel, GroupMailType } from "../db/GroupMail";
import { findWhere } from "underscore";
import { MAIL_TYPE, MAIL_TEM_TYPE, GM_MAIL_TYPE, MAIL_STATUS } from "../consts/constModules/mailConst";
import { DATA_NAME } from '../consts/dataName';
import { lockData } from './redLockService';
export async function sendMail(operate: number, toRoleId: string, sendName: string = '系统', params: string[] = [], goods: RewardInter[] = []) {
let content = getContent( operate, params);
let mail = await MailModel.addMail({roleId: toRoleId, goods, sendName, mailId: 1, content});
let { content, time } = getContent(operate, params);
if (!content)
return;
let mail = await MailModel.addMail({roleId: toRoleId, goods, sendName, mailId: JSON.stringify(operate), endTime: time + nowSeconds(), mailTemType: MAIL_TEM_TYPE.GAMEMAIL, params});
let key = 'login_roleId_' + toRoleId;
let sid = await getRedis(key);
if (!!sid) {
pinus.app.channelService.pushMessageByUids('onMailsAdd', resResult(STATUS.SUCCESS, { mails:[mail] }), [{uid: toRoleId, sid}]);
pinus.app.channelService.pushMessageByUids('onMailsAdd', resResult(STATUS.SUCCESS, { mails:[{
id: mail._id, mailId: mail.mailId, goods, sendTime: mail.sendTime, endTime: mail.endTime, content, status: mail.status, mailType: MAIL_TYPE.SINGLEMAIL, sendName
}]}), [{uid: toRoleId, sid}]);
}
}
export function getContent(operate: number, params: string[]) {
let content = gameData.mail.get(operate)||'%d';
let mail = gameData.mail.get(operate);
if (!mail)
return {};
let { content, time } = mail;
content = content||'%d';
for(let p of params) {
content = content.replace(/%d/, p);
}
return content
return { content, time }
}
export async function getMailContent(roleId: string, operate: number, params: string[], goods: RewardInter[], mails: MailType[], pushMessage: pushMail[], sendName: string = '系统') {
const doc = new MailModel();
let content = getContent( operate, params);
const mail = Object.assign(doc.toJSON(), { roleId, goods, sendName, mailId: 1, sendTime: nowSeconds(), content });
let { content, time } = getContent(operate, params);
if (!content)
return;
const mail = Object.assign(doc.toJSON(), { roleId, goods, sendName, mailId: operate, sendTime: nowSeconds(), mailTemType: MAIL_TEM_TYPE.GAMEMAIL, endTime: time + nowSeconds(), params });
mails.push(mail);
let key = 'login_roleId_' + roleId;
let sid = await getRedis(key);
if (!!sid) {
pushMessage.push({route: 'onMailsAdd', data:[mail], uids: [{ uid: roleId, sid }]});
pushMessage.push({route: 'onMailsAdd', data:[{
id: mail._id, mailId: mail.mailId, goods, sendTime: mail.sendTime, endTime: mail.endTime, content, status: mail.status, mailType: MAIL_TYPE.SINGLEMAIL, sendName
}], uids: [{ uid: roleId, sid }]});
}
}
export async function refreshMails(roleId: string, sid: string, serverId: number, updatedMailAt: number) {
let res:any = await lockData(serverId, DATA_NAME.GAMEMAIL, roleId);//加锁
let gmMails = await pinus.app.rpc.gm.gmRemote.getMails.toServer('gm-server-1', updatedMailAt, serverId);
let addGroupMails: GroupMailType[] = [];
let addMails: MailType[] = [];
let updateMails: mailData[] = [];
let pushMails: mailData[] = [];
gmMails.forEach(async function ({gmMailType, _id, sendRoles, endTime, content, goods, sendTime, sendName}) {
if (gmMailType == GM_MAIL_TYPE.GROUPMAIL) { //群体邮件
let mail = await GroupMailModel.getMail(_id, MAIL_TEM_TYPE.GMTYPE);
if (!mail) {
const doc = new GroupMailModel();
const mail = Object.assign(doc.toJSON(), { mailId: _id, mailTemType: MAIL_TEM_TYPE.GMTYPE, sendRoles });
addGroupMails.push(mail);
pushMails.push({ id: mail._id, mailId: _id, goods, sendTime, endTime, content, status: mail.status, mailType: MAIL_TYPE.GROUPMAIL, sendName });
} else {
let { sendRoles } = mail;
let sendRole = findWhere(sendRoles, {roleId});
if (!sendRole) {
await GroupMailModel.pushRoleMail(roleId, _id, MAIL_TEM_TYPE.GMTYPE);
pushMails.push({ id: mail._id, mailId: _id, goods, sendTime, endTime, content, status: MAIL_STATUS.CREATE, mailType: MAIL_TYPE.GROUPMAIL, sendName });
}
}
} else if (gmMailType == GM_MAIL_TYPE.SERVER) { //游戏服邮件
let mail = await MailModel.getMail(roleId, _id, MAIL_TEM_TYPE.GMTYPE);
if (!mail) {
const doc = new MailModel();
const mail = Object.assign(doc.toJSON(), { mailId: _id, mailTemType: MAIL_TEM_TYPE.GMTYPE, roleId });
addMails.push(mail);
pushMails.push({ id: mail._id, mailId: _id, goods, sendTime, endTime, content, status: mail.status, mailType: MAIL_TYPE.SINGLEMAIL, sendName });
} else {
updateMails.push({ id: mail._id, mailId: _id, goods, sendTime, endTime, content, status: mail.status, mailType: MAIL_TYPE.SINGLEMAIL, sendName })
}
}
});
if (!!updateMails.length) {
pinus.app.channelService.pushMessageByUids('onMailsUpdate', resResult(STATUS.SUCCESS, { mails: updateMails }), [{uid: roleId, sid}]);
}
if (!!addGroupMails.length) {
await GroupMailModel.addGroupMails(addGroupMails);
}
if (!!addMails.length) {
await MailModel.addMails(addMails);
}
if (!!pushMails.length) {
pinus.app.channelService.pushMessageByUids('onMailsAdd', resResult(STATUS.SUCCESS, { mails: pushMails}), [{uid: roleId, sid}]);
}
res.releaseCallback();
return nowSeconds();
}
export async function getMails(roleId: string, serverId: number) {
let mails = await MailModel.getMailsByRoleId(roleId)||[];
let groupMails = await GroupMailModel.getGroupMailsByRoleId(roleId)||[];
let list: mailData[] = await pinus.app.rpc.gm.gmRemote.getMailInfos.toServer('gm-server-1', roleId, serverId, mails, groupMails);
return list;
}

View File

@@ -0,0 +1,18 @@
import { FrontendOrBackendSession, pinus } from "pinus";
import { refreshMails } from '../services/mailService';
import { STATUS } from '../consts/statusCode';
import { resResult } from '../pubUtils/util';
import { nowSeconds } from "../pubUtils/timeUtil";
export async function refresh(session: FrontendOrBackendSession) {
const roleId = session.get('roleId');
const sid = session.get('sid');
const serverId: number = parseInt(session.get('serverId'));
let updatedMailAt: number = parseInt(session.get('updatedMailAt')) || 0;
let uids = [{uid: roleId, sid}];
pinus.app.get('channelService').pushMessageByUids('onPushCurrentTime', resResult(STATUS.SUCCESS, {time: Date.now()}), uids);
if (!!roleId && updatedMailAt < nowSeconds() - 5) { //保持最少5秒间隙
session.set('updatedMailAt', nowSeconds());
await refreshMails(roleId, sid, serverId, updatedMailAt);
}
}

View File

@@ -8,7 +8,7 @@ import { getPvpGkWarIds, getPvpRankRewards, getPvpHeroRewards, getResultMaxRank
import { deepCopy, getRandomArr, resResult } from '../pubUtils/util';
import { getLvByScore } from './pvpService';
import { getMyRank, setRank, resetPvpRanks } from './redisService';
import { REDIS_KEY } from '../consts';
import { MAIL_TYPE, REDIS_KEY } from '../consts';
import { RankParam } from '../domain/rank';
import { RoleModel } from '../db/Role';
import { MailModel, MailType } from '../db/Mail';
@@ -89,7 +89,7 @@ export async function setPvpDefResultOnTime(pvpDefense: PvpDefenseType, seasonNu
let { score, pLv, heroScores, challengeCnt, challengeRefTime, goods } = await checkResult(pvpDefense, seasonNum, oldSeasonEndTime);
pvpDefense = await PvpDefenseModel.updateInfo(pvpDefense.roleId, {score, pLv, heroScores, seasonNum, challengeCnt, challengeRefTime});
//下发邮件
await getMailContent(pvpDefense.roleId, 1, [], goods, addMails, pushMessage);
await getMailContent(pvpDefense.roleId, MAIL_TYPE.PVP_RANK_REWARD, [], goods, addMails, pushMessage);
return pvpDefense;
}
@@ -153,7 +153,7 @@ export async function setPvpDefResult(pvpDefense: PvpDefenseType, seasonNum: num
let params = new RankParam(roleName, lv, vLv, headHid, sHid, title);
setRank(REDIS_KEY.PVP_RANK, 0, roleId, pvpDefense.score, pvpDefense.updatedAt.getTime(), params);
//下发邮件
await sendMail(1, roleId, '系统', [], goods);
await sendMail(MAIL_TYPE.PVP_RANK_REWARD, roleId, '系统', [], goods);
return pvpDefense;
}

View File

@@ -117,18 +117,6 @@ export enum GUILD_REC_TYPE {
SET_LEADER = 10, // 转让团长 guildName roleName
IMPEACH = 11, // 弹劾 roleName roleName
}
export enum GUILD_DATA_NAME {
BOSS_SCRIPT = 'BossInstance',
TRAIN = 'BossInstance',
TRAIN_BOX = 'BossInstanceBox',
GUILD = 'Guild',
GUILD_REFINE = 'GuildRefine',
GUILD_ASSIST_REFINE = 'GuildAssistRefine',
UP_STRUCTURE = 'GuildStructure',
JOIN_GUILD = 'JoinGuild',
REFRESH_ACTIVE = 'GuildRefActive',
WEEKLY_GUILD_SUM = 'WeeklyGuildSum', // 每周结算活跃和奖励
}
export const GUILD_REPORT_NUM = 40;

View File

@@ -0,0 +1,18 @@
export const MAIL_STATUS = {
DELETE: -1,
CREATE: 0,
READ: 1,
RECEIVED: 2,
};
export const MAIL_TYPE = {
SINGLEMAIL: 1,
GROUPMAIL: 2,
};
export const MAIL_TEM_TYPE = {
GAMEMAIL: 1,
GMTYPE: 2,
};
export const GM_MAIL_TYPE = {
GROUPMAIL: 1, //1:群体邮件
SERVER: 2, //2分服务器邮件
};

View File

@@ -8,205 +8,205 @@ export const ENCRYPT_KEY = 'fiqaxijabbantusmprc234fj';
export const AUTH_SMS_CNT_PER_DAY = 8;
export const COUNTER = {
UID: { name: 'uid', def: 1 },
GMUID: { name: 'gmuid', def: 1 },
API: { name: 'api', def: 1 },
GM_GROUP: { name: 'gmgroup', def: 1 },
HID: { name: 'hid', def: 10000 },
EID: { name: 'eid', def: 1 },
ROLE: { name: 'role', def: 1 }
UID: { name: 'uid', def: 1 },
GMUID: { name: 'gmuid', def: 1 },
API: { name: 'api', def: 1 },
GM_GROUP: { name: 'gmgroup', def: 1 },
HID: { name: 'hid', def: 10000 },
EID: { name: 'eid', def: 1 },
ROLE: { name: 'role', def: 1 }
};
export const DEFAULT_HEROES = [19, 53, 55, 54, 13];
export const DEFAULT_ITEMS = [
{"id": 11004, "count": 99999999},
{"id": 11013, "count": 999999},
{"id": 11014, "count": 999999},
{"id": 11015, "count": 999999},
{"id": 11016, "count": 999999},
{"id": 17001, "count": 99999999},
{"id": 17002, "count": 99999999},
{"id": 17003, "count": 99999999},
{"id": 17004, "count": 99999999},
{"id": 17005, "count": 99999999},
{"id": 17006, "count": 99999999},
{"id": 17007, "count": 99999999},
{"id": 17008, "count": 99999999},
{"id": 17009, "count": 99999999},
{"id": 17010, "count": 99999999},
{"id": 17011, "count": 99999999},
{"id": 17012, "count": 99999999},
{"id": 17013, "count": 99999999},
{"id": 17014, "count": 99999999},
{"id": 17015, "count": 99999999},
{"id": 17016, "count": 99999999},
{"id": 17017, "count": 99999999},
{"id": 17018, "count": 99999999},
{"id": 17019, "count": 99999999},
{"id": 17020, "count": 99999999},
{"id": 17021, "count": 99999999},
{"id": 17022, "count": 99999999},
{"id": 17023, "count": 99999999},
{"id": 17024, "count": 99999999},
{"id": 17025, "count": 99999999},
{"id": 17026, "count": 99999999},
{"id": 17027, "count": 99999999},
{"id": 17028, "count": 99999999},
{"id": 17029, "count": 99999999},
{"id": 17030, "count": 99999999},
{"id": 17031, "count": 99999999},
{"id": 17032, "count": 99999999},
{"id": 17033, "count": 99999999},
{"id": 17037, "count": 99999999},
{"id": 17038, "count": 99999999},
{"id": 17039, "count": 99999999},
{"id": 17040, "count": 99999999},
{"id": 17041, "count": 99999999},
{"id": 17042, "count": 99999999},
{"id": 17043, "count": 99999999},
{"id": 17044, "count": 99999999},
{"id": 17045, "count": 99999999},
{"id": 17046, "count": 99999999},
{"id": 17047, "count": 99999999},
{"id": 17048, "count": 99999999},
{"id": 17049, "count": 99999999},
{"id": 17050, "count": 99999999},
{"id": 17051, "count": 99999999},
{"id": 17052, "count": 99999999},
{"id": 21009, "count": 99999999},
{"id": 21011, "count": 99999999},
{"id": 21012, "count": 99999999},
{"id": 21014, "count": 99999999},
{"id": 21015, "count": 99999999},
{"id": 21042, "count": 99999999},
{"id": 42083, "count": 9999},
{"id": 42084, "count": 9999},
{"id": 42085, "count": 9999},
{"id": 42086, "count": 9999},
{"id": 42087, "count": 9999},
{"id": 42088, "count": 9999},
{"id": 42176, "count": 9999},
{"id": 42177, "count": 9999},
{"id": 42178, "count": 9999},
{"id": 42179, "count": 9999},
{"id": 42180, "count": 9999},
{"id": 50059, "count": 1},
{"id": 50060, "count": 1},
{"id": 50061, "count": 1},
{"id": 50062, "count": 1},
{"id": 50089, "count": 1},
{"id": 50090, "count": 1},
{"id": 50091, "count": 1},
{"id": 50107, "count": 1},
{"id": 50108, "count": 1},
{"id": 50109, "count": 1},
{ "id": 11004, "count": 99999999 },
{ "id": 11013, "count": 999999 },
{ "id": 11014, "count": 999999 },
{ "id": 11015, "count": 999999 },
{ "id": 11016, "count": 999999 },
{ "id": 17001, "count": 99999999 },
{ "id": 17002, "count": 99999999 },
{ "id": 17003, "count": 99999999 },
{ "id": 17004, "count": 99999999 },
{ "id": 17005, "count": 99999999 },
{ "id": 17006, "count": 99999999 },
{ "id": 17007, "count": 99999999 },
{ "id": 17008, "count": 99999999 },
{ "id": 17009, "count": 99999999 },
{ "id": 17010, "count": 99999999 },
{ "id": 17011, "count": 99999999 },
{ "id": 17012, "count": 99999999 },
{ "id": 17013, "count": 99999999 },
{ "id": 17014, "count": 99999999 },
{ "id": 17015, "count": 99999999 },
{ "id": 17016, "count": 99999999 },
{ "id": 17017, "count": 99999999 },
{ "id": 17018, "count": 99999999 },
{ "id": 17019, "count": 99999999 },
{ "id": 17020, "count": 99999999 },
{ "id": 17021, "count": 99999999 },
{ "id": 17022, "count": 99999999 },
{ "id": 17023, "count": 99999999 },
{ "id": 17024, "count": 99999999 },
{ "id": 17025, "count": 99999999 },
{ "id": 17026, "count": 99999999 },
{ "id": 17027, "count": 99999999 },
{ "id": 17028, "count": 99999999 },
{ "id": 17029, "count": 99999999 },
{ "id": 17030, "count": 99999999 },
{ "id": 17031, "count": 99999999 },
{ "id": 17032, "count": 99999999 },
{ "id": 17033, "count": 99999999 },
{ "id": 17037, "count": 99999999 },
{ "id": 17038, "count": 99999999 },
{ "id": 17039, "count": 99999999 },
{ "id": 17040, "count": 99999999 },
{ "id": 17041, "count": 99999999 },
{ "id": 17042, "count": 99999999 },
{ "id": 17043, "count": 99999999 },
{ "id": 17044, "count": 99999999 },
{ "id": 17045, "count": 99999999 },
{ "id": 17046, "count": 99999999 },
{ "id": 17047, "count": 99999999 },
{ "id": 17048, "count": 99999999 },
{ "id": 17049, "count": 99999999 },
{ "id": 17050, "count": 99999999 },
{ "id": 17051, "count": 99999999 },
{ "id": 17052, "count": 99999999 },
{"id": 60001, "count": 8888888},
{"id": 60002, "count": 8888888},
{"id": 60003, "count": 8888888},
{"id": 60004, "count": 8888888},
{"id": 60005, "count": 8888888},
{"id": 60006, "count": 8888888},
{"id": 60007, "count": 8888888},
{"id": 60008, "count": 8888888},
{"id": 60009, "count": 8888888},
{"id": 60011, "count": 8888888},
{"id": 60012, "count": 8888888},
{"id": 60013, "count": 8888888},
{"id": 60014, "count": 8888888},
{"id": 60015, "count": 8888888},
{"id": 60016, "count": 8888888},
{"id": 60017, "count": 8888888},
{"id": 60018, "count": 8888888},
{"id": 60019, "count": 8888888},
{"id": 60021, "count": 8888888},
{"id": 60022, "count": 8888888},
{"id": 60023, "count": 8888888},
{"id": 60024, "count": 8888888},
{"id": 60025, "count": 8888888},
{"id": 60026, "count": 8888888},
{"id": 60027, "count": 8888888},
{"id": 60028, "count": 8888888},
{"id": 60029, "count": 8888888},
{"id": 60031, "count": 8888888},
{"id": 60032, "count": 8888888},
{"id": 60033, "count": 8888888},
{"id": 60034, "count": 8888888},
{"id": 60035, "count": 8888888},
{"id": 60036, "count": 8888888},
{"id": 60037, "count": 8888888},
{"id": 60038, "count": 8888888},
{"id": 60039, "count": 8888888},
{"id": 60041, "count": 8888888},
{"id": 60042, "count": 8888888},
{"id": 60043, "count": 8888888},
{"id": 60044, "count": 8888888},
{"id": 60045, "count": 8888888},
{"id": 60046, "count": 8888888},
{"id": 60047, "count": 8888888},
{"id": 60048, "count": 8888888},
{"id": 60049, "count": 8888888},
{"id": 60051, "count": 8888888},
{"id": 60052, "count": 8888888},
{"id": 60053, "count": 8888888},
{"id": 60054, "count": 8888888},
{"id": 60055, "count": 8888888},
{"id": 60056, "count": 8888888},
{"id": 60057, "count": 8888888},
{"id": 60058, "count": 8888888},
{"id": 60059, "count": 8888888},
{"id": 60060, "count": 8888888},
{ "id": 21009, "count": 99999999 },
{ "id": 21011, "count": 99999999 },
{ "id": 21012, "count": 99999999 },
{ "id": 21014, "count": 99999999 },
{ "id": 21015, "count": 99999999 },
{ "id": 21042, "count": 99999999 },
{ "id": 42083, "count": 9999 },
{ "id": 42084, "count": 9999 },
{ "id": 42085, "count": 9999 },
{ "id": 42086, "count": 9999 },
{ "id": 42087, "count": 9999 },
{ "id": 42088, "count": 9999 },
{ "id": 42176, "count": 9999 },
{ "id": 42177, "count": 9999 },
{ "id": 42178, "count": 9999 },
{ "id": 42179, "count": 9999 },
{ "id": 42180, "count": 9999 },
{ "id": 50059, "count": 1 },
{ "id": 50060, "count": 1 },
{ "id": 50061, "count": 1 },
{ "id": 50062, "count": 1 },
{ "id": 50089, "count": 1 },
{ "id": 50090, "count": 1 },
{ "id": 50091, "count": 1 },
{ "id": 50107, "count": 1 },
{ "id": 50108, "count": 1 },
{ "id": 50109, "count": 1 },
{ "id": 60001, "count": 8888888 },
{ "id": 60002, "count": 8888888 },
{ "id": 60003, "count": 8888888 },
{ "id": 60004, "count": 8888888 },
{ "id": 60005, "count": 8888888 },
{ "id": 60006, "count": 8888888 },
{ "id": 60007, "count": 8888888 },
{ "id": 60008, "count": 8888888 },
{ "id": 60009, "count": 8888888 },
{ "id": 60011, "count": 8888888 },
{ "id": 60012, "count": 8888888 },
{ "id": 60013, "count": 8888888 },
{ "id": 60014, "count": 8888888 },
{ "id": 60015, "count": 8888888 },
{ "id": 60016, "count": 8888888 },
{ "id": 60017, "count": 8888888 },
{ "id": 60018, "count": 8888888 },
{ "id": 60019, "count": 8888888 },
{ "id": 60021, "count": 8888888 },
{ "id": 60022, "count": 8888888 },
{ "id": 60023, "count": 8888888 },
{ "id": 60024, "count": 8888888 },
{ "id": 60025, "count": 8888888 },
{ "id": 60026, "count": 8888888 },
{ "id": 60027, "count": 8888888 },
{ "id": 60028, "count": 8888888 },
{ "id": 60029, "count": 8888888 },
{ "id": 60031, "count": 8888888 },
{ "id": 60032, "count": 8888888 },
{ "id": 60033, "count": 8888888 },
{ "id": 60034, "count": 8888888 },
{ "id": 60035, "count": 8888888 },
{ "id": 60036, "count": 8888888 },
{ "id": 60037, "count": 8888888 },
{ "id": 60038, "count": 8888888 },
{ "id": 60039, "count": 8888888 },
{ "id": 60041, "count": 8888888 },
{ "id": 60042, "count": 8888888 },
{ "id": 60043, "count": 8888888 },
{ "id": 60044, "count": 8888888 },
{ "id": 60045, "count": 8888888 },
{ "id": 60046, "count": 8888888 },
{ "id": 60047, "count": 8888888 },
{ "id": 60048, "count": 8888888 },
{ "id": 60049, "count": 8888888 },
{ "id": 60051, "count": 8888888 },
{ "id": 60052, "count": 8888888 },
{ "id": 60053, "count": 8888888 },
{ "id": 60054, "count": 8888888 },
{ "id": 60055, "count": 8888888 },
{ "id": 60056, "count": 8888888 },
{ "id": 60057, "count": 8888888 },
{ "id": 60058, "count": 8888888 },
{ "id": 60059, "count": 8888888 },
{ "id": 60060, "count": 8888888 },
];
export const DEFAULT_EQUIPS = [
{"id": 8, "count": 1},
{"id": 108, "count": 1},
{"id": 208, "count": 1},
{"id": 308, "count": 1},
{"id": 408, "count": 1},
{"id": 508, "count": 1},
{"id": 608, "count": 1},
{"id": 708, "count": 1},
{"id": 2008, "count": 1},
{"id": 2108, "count": 1},
{"id": 2208, "count": 1},
{"id": 3008, "count": 1},
{"id": 3108, "count": 1},
{"id": 3208, "count": 1},
{"id": 4008, "count": 1},
{"id": 4108, "count": 1},
{"id": 4208, "count": 1},
{"id": 5008, "count": 1},
{"id": 5108, "count": 1},
{"id": 5208, "count": 1},
{"id": 6008, "count": 1},
{"id": 6108, "count": 1},
{"id": 6208, "count": 1},
{"id": 26, "count": 1},
{"id": 126, "count": 1},
{"id": 226, "count": 1},
{"id": 326, "count": 1},
{"id": 426, "count": 1},
{"id": 526, "count": 1},
{"id": 626, "count": 1},
{"id": 726, "count": 1},
{"id": 2026, "count": 1},
{"id": 2126, "count": 1},
{"id": 2226, "count": 1},
{"id": 3026, "count": 1},
{"id": 3126, "count": 1},
{"id": 3226, "count": 1},
{"id": 4026, "count": 1},
{"id": 4126, "count": 1},
{"id": 4226, "count": 1},
{"id": 5026, "count": 1},
{"id": 5126, "count": 1},
{"id": 5226, "count": 1},
{"id": 6026, "count": 1},
{"id": 6126, "count": 1},
{"id": 6226, "count": 1},
{ "id": 8, "count": 1 },
{ "id": 108, "count": 1 },
{ "id": 208, "count": 1 },
{ "id": 308, "count": 1 },
{ "id": 408, "count": 1 },
{ "id": 508, "count": 1 },
{ "id": 608, "count": 1 },
{ "id": 708, "count": 1 },
{ "id": 2008, "count": 1 },
{ "id": 2108, "count": 1 },
{ "id": 2208, "count": 1 },
{ "id": 3008, "count": 1 },
{ "id": 3108, "count": 1 },
{ "id": 3208, "count": 1 },
{ "id": 4008, "count": 1 },
{ "id": 4108, "count": 1 },
{ "id": 4208, "count": 1 },
{ "id": 5008, "count": 1 },
{ "id": 5108, "count": 1 },
{ "id": 5208, "count": 1 },
{ "id": 6008, "count": 1 },
{ "id": 6108, "count": 1 },
{ "id": 6208, "count": 1 },
{ "id": 26, "count": 1 },
{ "id": 126, "count": 1 },
{ "id": 226, "count": 1 },
{ "id": 326, "count": 1 },
{ "id": 426, "count": 1 },
{ "id": 526, "count": 1 },
{ "id": 626, "count": 1 },
{ "id": 726, "count": 1 },
{ "id": 2026, "count": 1 },
{ "id": 2126, "count": 1 },
{ "id": 2226, "count": 1 },
{ "id": 3026, "count": 1 },
{ "id": 3126, "count": 1 },
{ "id": 3226, "count": 1 },
{ "id": 4026, "count": 1 },
{ "id": 4126, "count": 1 },
{ "id": 4226, "count": 1 },
{ "id": 5026, "count": 1 },
{ "id": 5126, "count": 1 },
{ "id": 5226, "count": 1 },
{ "id": 6026, "count": 1 },
{ "id": 6126, "count": 1 },
{ "id": 6226, "count": 1 },
];
export const DEFAULT_GOLD = 9999999999;
export const DEFAULT_COIN = 9999999999;
@@ -228,9 +228,9 @@ export const REDIS_KEY = {
// 各排行榜对应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.TOWER_RANK, REDIS_KEY.USER_INFO],
[REDIS_KEY.PVP_RANK, REDIS_KEY.USER_INFO],
[REDIS_KEY.GUILD_ACTIVE_RANK, REDIS_KEY.GUILD_INFO]
]);
export const FUNC_OPT_TYPE = {
@@ -244,144 +244,156 @@ export const FUNCS_ID = {
}
export const FRIEND_DROP_TYPE = {
COM_BATTLE: 1,
SEND_GIFT: 2
COM_BATTLE: 1,
SEND_GIFT: 2
}
// 每日情谊点上限
export const FRIEND_DROP_MAX = {
COM_BTL: 150
COM_BTL: 150
}
export const FILENAME = {
DIC_BLUEPRT_COMPOSE: 'dic_blueprt_compose',
DIC_BLUEPRT_POSSIBILITY: 'dic_blueprt_possibility',
DIC_EXPEDITION: 'dic_expedition',
DIC_EXPEDITION_POINT: 'dic_expedition_point',
DIC_FUNC_SWITCH: 'dic_func_switch',
DIC_GOODS: 'dic_goods',
DIC_CHAREXP: 'dic_zyz_charexp',
DIC_DAILY: 'dic_zyz_daily',
DIC_EVENT: 'dic_zyz_event',
DIC_FASHIONS: 'dic_zyz_fashions',
DIC_FRIEND_SHIP: 'dic_zyz_friend_ship',
DIC_FRIEND_SHIP_LEVEL: 'dic_zyz_friend_ship_level',
DIC_GACHA: 'dic_gacha',
DIC_GK_BRANCH: 'dic_zyz_gk_branch',
DIC_GK_DAILY: 'dic_zyz_gk_daily',
DIC_GK_DUNGEON: 'dic_zyz_gk_dungeon',
DIC_GK_DUNGEON_ELITE: 'dic_zyz_gk_dungeonElite',
DIC_GK_EVENT: 'dic_zyz_gk_event',
DIC_GK_EXPEDITION: 'dic_zyz_gk_expedition',
DIC_GK_MAIN: 'dic_zyz_gk_main',
DIC_GK_MAIN_ELITE: 'dic_zyz_gk_mainElite',
DIC_GK_TOWER: 'dic_zyz_gk_tower',
DIC_GK_TREASURE: 'dic_zyz_gk_Treasure',
DIC_HERO: 'dic_zyz_hero',
DIC_HERO_QUALITY_UP: 'dic_zyz_hero_quality_up',
DIC_HERO_STAR: 'dic_zyz_hero_star',
DIC_HERO_WAKE: 'dic_zyz_hero_wake',
DIC_HERO_SKILL: 'dic_zyz_heroskill',
DIC_JOB: 'dic_zyz_job',
DIC_KING_EXP: 'dic_zyz_kingexp',
DIC_CHAR_EXP: 'dic_zyz_charexp',
DIC_SE: 'dic_zyz_se',
DIC_TOWER_TASK: 'dic_zyz_search',
DIC_TOWER: 'dic_zyz_tower',
DIC_XUNBAO: 'dic_zyz_xunbao',
DIC_QUESTION: 'Questions',
DIC_RANDOM_EFFECT_POOL: 'dic_zyz_randomEffectPool',
DIC_STRENGTHEN_COST: 'dic_zyz_enhancementCost',
DIC_REFINE: 'dic_zyz_jinglian',
DIC_HERO_EQUIP: 'dic_zyz_heroEquip',
DIC_SUIT: 'dic_zyz_suit',
DIC_TITLE: 'dic_zyz_title',
DIC_TERAPH: 'dic_zyz_teraph',
DIC_SCHOOL: 'dic_zyz_school',
DIC_SCHOOL_RATE: 'dic_zyz_schoolRate',
DIC_HERO_SCROLL: 'dic_zyz_heroScroll',
DIC_PVP_OPPONENT: 'dic_pvp_opponent',
DIC_PVP_TEAM_LEVEL: 'dic_pvp_teamLevel',
DIC_GK_PVP: 'dic_zyz_gk_pvp',
DIC_PVP_REFRESH_CONSUME: 'dic_pvp_refreshConsume',
DIC_PVP_HERO_REWARD: 'dic_pvp_heroAccountReward',
DIC_PVP_RANK_REWARD: 'dic_pvp_rankReward',
DIC_PVP_BOX: 'dic_pvp_boxReward',
DIC_GUILD_AUTH: 'dic_army_authority',
DIC_GUILD_STRUCTURE_CENTER: 'dic_army_structureCentre',
DIC_GUILD_EQUIP_PRODUCE_BASE: 'dic_army_equipProduceBase',
DIC_GUILD_BOSS_BASE: 'dic_army_bossBase',
DIC_GUILD_TRAIN_BASE: 'dic_army_trainBase',
DIC_GUILD_DONATE_BASE: 'dic_army_donateBase',
DIC_GUILD_WISH_POOL_BASE: 'dic_army_wishPool',
DIC_GUILD_STORE_BASE: 'dic_army_storeBase',
DIC_GUILD_POSITION: 'dic_army_position',
DIC_ACTIVE_DAY_REWARD: 'dic_army_activeDayReward',
DIC_ACTIVE_WEEK_REWARD: 'dic_army_activeWeekReward',
DIC_MAIL: 'dic_email_army',
DIC_ARMY_TRAIN_JU_DIAN: 'dic_army_trainJuDian',
DIC_ARMY_TRAIN_SOLO_REWARD: 'dic_army_trainSoloReward',
DIC_ARMY_ACTIVE_POINT_WAYS: 'dic_army_activePointWays',
DIC_ARMY_DEVELOPMENTCONSUME: 'dic_army_developmentConsume',
DIC_ARMY_BOSS_RANK_REWARD: 'dic_army_bossrankReward',
DIC_ARMY_DONATE_BOX_REWARD: 'dic_army_donateBoxReward',
DIC_ROLE_FRIEND: 'dic_zyz_friends',
DIC_ROLE_FRIEND_LEVEL: 'dic_zyz_closelevel'
DIC_BLUEPRT_COMPOSE: 'dic_blueprt_compose',
DIC_BLUEPRT_POSSIBILITY: 'dic_blueprt_possibility',
DIC_EXPEDITION: 'dic_expedition',
DIC_EXPEDITION_POINT: 'dic_expedition_point',
DIC_FUNC_SWITCH: 'dic_func_switch',
DIC_GOODS: 'dic_goods',
DIC_CHAREXP: 'dic_zyz_charexp',
DIC_DAILY: 'dic_zyz_daily',
DIC_EVENT: 'dic_zyz_event',
DIC_FASHIONS: 'dic_zyz_fashions',
DIC_FRIEND_SHIP: 'dic_zyz_friend_ship',
DIC_FRIEND_SHIP_LEVEL: 'dic_zyz_friend_ship_level',
DIC_GACHA: 'dic_gacha',
DIC_GK_BRANCH: 'dic_zyz_gk_branch',
DIC_GK_DAILY: 'dic_zyz_gk_daily',
DIC_GK_DUNGEON: 'dic_zyz_gk_dungeon',
DIC_GK_DUNGEON_ELITE: 'dic_zyz_gk_dungeonElite',
DIC_GK_EVENT: 'dic_zyz_gk_event',
DIC_GK_EXPEDITION: 'dic_zyz_gk_expedition',
DIC_GK_MAIN: 'dic_zyz_gk_main',
DIC_GK_MAIN_ELITE: 'dic_zyz_gk_mainElite',
DIC_GK_TOWER: 'dic_zyz_gk_tower',
DIC_GK_TREASURE: 'dic_zyz_gk_Treasure',
DIC_HERO: 'dic_zyz_hero',
DIC_HERO_QUALITY_UP: 'dic_zyz_hero_quality_up',
DIC_HERO_STAR: 'dic_zyz_hero_star',
DIC_HERO_WAKE: 'dic_zyz_hero_wake',
DIC_HERO_SKILL: 'dic_zyz_heroskill',
DIC_JOB: 'dic_zyz_job',
DIC_KING_EXP: 'dic_zyz_kingexp',
DIC_CHAR_EXP: 'dic_zyz_charexp',
DIC_SE: 'dic_zyz_se',
DIC_TOWER_TASK: 'dic_zyz_search',
DIC_TOWER: 'dic_zyz_tower',
DIC_XUNBAO: 'dic_zyz_xunbao',
DIC_QUESTION: 'Questions',
DIC_RANDOM_EFFECT_POOL: 'dic_zyz_randomEffectPool',
DIC_STRENGTHEN_COST: 'dic_zyz_enhancementCost',
DIC_REFINE: 'dic_zyz_jinglian',
DIC_HERO_EQUIP: 'dic_zyz_heroEquip',
DIC_SUIT: 'dic_zyz_suit',
DIC_TITLE: 'dic_zyz_title',
DIC_TERAPH: 'dic_zyz_teraph',
DIC_SCHOOL: 'dic_zyz_school',
DIC_SCHOOL_RATE: 'dic_zyz_schoolRate',
DIC_HERO_SCROLL: 'dic_zyz_heroScroll',
DIC_PVP_OPPONENT: 'dic_pvp_opponent',
DIC_PVP_TEAM_LEVEL: 'dic_pvp_teamLevel',
DIC_GK_PVP: 'dic_zyz_gk_pvp',
DIC_PVP_REFRESH_CONSUME: 'dic_pvp_refreshConsume',
DIC_PVP_HERO_REWARD: 'dic_pvp_heroAccountReward',
DIC_PVP_RANK_REWARD: 'dic_pvp_rankReward',
DIC_PVP_BOX: 'dic_pvp_boxReward',
DIC_GUILD_AUTH: 'dic_army_authority',
DIC_GUILD_STRUCTURE_CENTER: 'dic_army_structureCentre',
DIC_GUILD_EQUIP_PRODUCE_BASE: 'dic_army_equipProduceBase',
DIC_GUILD_BOSS_BASE: 'dic_army_bossBase',
DIC_GUILD_TRAIN_BASE: 'dic_army_trainBase',
DIC_GUILD_DONATE_BASE: 'dic_army_donateBase',
DIC_GUILD_WISH_POOL_BASE: 'dic_army_wishPool',
DIC_GUILD_STORE_BASE: 'dic_army_storeBase',
DIC_GUILD_POSITION: 'dic_army_position',
DIC_ACTIVE_DAY_REWARD: 'dic_army_activeDayReward',
DIC_ACTIVE_WEEK_REWARD: 'dic_army_activeWeekReward',
DIC_MAIL: 'dic_email_content',
DIC_ARMY_TRAIN_JU_DIAN: 'dic_army_trainJuDian',
DIC_ARMY_TRAIN_SOLO_REWARD: 'dic_army_trainSoloReward',
DIC_ARMY_ACTIVE_POINT_WAYS: 'dic_army_activePointWays',
DIC_ARMY_DEVELOPMENTCONSUME: 'dic_army_developmentConsume',
DIC_ARMY_BOSS_RANK_REWARD: 'dic_army_bossrankReward',
DIC_ARMY_DONATE_BOX_REWARD: 'dic_army_donateBoxReward',
DIC_ROLE_FRIEND: 'dic_zyz_friends',
DIC_ROLE_FRIEND_LEVEL: 'dic_zyz_closelevel'
}
export const WAR_RELATE_TABLES = [
FILENAME.DIC_GK_BRANCH,
FILENAME.DIC_GK_DAILY,
FILENAME.DIC_GK_DUNGEON,
FILENAME.DIC_GK_DUNGEON_ELITE,
FILENAME.DIC_GK_EVENT,
FILENAME.DIC_GK_EXPEDITION,
FILENAME.DIC_GK_MAIN,
FILENAME.DIC_GK_MAIN_ELITE,
FILENAME.DIC_GK_TOWER,
FILENAME.DIC_GK_TREASURE,
FILENAME.DIC_GK_PVP
FILENAME.DIC_GK_BRANCH,
FILENAME.DIC_GK_DAILY,
FILENAME.DIC_GK_DUNGEON,
FILENAME.DIC_GK_DUNGEON_ELITE,
FILENAME.DIC_GK_EVENT,
FILENAME.DIC_GK_EXPEDITION,
FILENAME.DIC_GK_MAIN,
FILENAME.DIC_GK_MAIN_ELITE,
FILENAME.DIC_GK_TOWER,
FILENAME.DIC_GK_TREASURE,
FILENAME.DIC_GK_PVP
]
// 装备栏强化类型
export const EQUIP_STRENGTHEN_TYPE = {
SINGLE: 1, // 单件单级强化
SINGLE_QUICK: 2, // 单件一键强化
ALL_QUICK: 3 // 武将全部装备栏一键强化
SINGLE: 1, // 单件单级强化
SINGLE_QUICK: 2, // 单件一键强化
ALL_QUICK: 3 // 武将全部装备栏一键强化
}
// 邮件内容类型
export const MAIL_TYPE = {
SEND_MAIL: 0,
GUILD_APPLY_REFUSE: 1,
GUILD_BE_IMPEACH: 2,
GUILD_BE_SET_LEADER: 3,
GUILD_BE_KICK: 4,
GUILD_ACTIVE_REWARD: 5,
GUILD_BE_SET_MANAGER: 6,
GUILD_BE_SET_MEMBER: 7
SEND_MAIL: 0,
GUILD_APPLY_REFUSE: 1,
GUILD_BE_IMPEACH: 2,
GUILD_BE_SET_LEADER: 3,
GUILD_BE_KICK: 4,
GUILD_ACTIVE_REWARD: 5,
GUILD_BE_SET_MANAGER: 6,
GUILD_BE_SET_MEMBER: 7,
GUILD_BOSS_OPEN: 8,
GUILD_BOSS_REWARD: 9,
GUILD_TRAIN_REWARD: 10,
WISH_POOL_REWARD: 11,
PVP_RESULT: 12,
PVP_RANK_REWARD: 13
};
export const CHAT_SERVER = 'chat-server-1';
export enum FRIEND_RELATION_TYPE {
NORMAL = 1,
HAS_FRIEND = 2,
HAS_BLOCKED = 3,
MYSELF = 4
NORMAL = 1,
HAS_FRIEND = 2,
HAS_BLOCKED = 3,
MYSELF = 4
}
export enum POPULATE_TYPE {
NOT = 0,
FRIEND = 1,
BLACKLIST = 2,
FRIENDSHIP = 3
NOT = 0,
FRIEND = 1,
BLACKLIST = 2,
FRIENDSHIP = 3
}
export enum BLOCK_OPEATE {
<<<<<<< HEAD
ADD = 1,
REMOVE_BLACK = 2,
REMOVE_AND_APPLY = 3,
REMOVE_FRIEND = 4
=======
ADD = 1,
REMOVE = 2,
REMOVE_AND_APPLY = 3
>>>>>>> cf60d7c...
}

13
shared/consts/dataName.ts Normal file
View File

@@ -0,0 +1,13 @@
export enum DATA_NAME {
BOSS_SCRIPT = 'BossInstance',
TRAIN = 'BossInstance',
TRAIN_BOX = 'BossInstanceBox',
GUILD = 'Guild',
GUILD_REFINE = 'GuildRefine',
GUILD_ASSIST_REFINE = 'GuildAssistRefine',
UP_STRUCTURE = 'GuildStructure',
JOIN_GUILD = 'JoinGuild',
REFRESH_ACTIVE = 'GuildRefActive',
WEEKLY_GUILD_SUM = 'WeeklyGuildSum', // 每周结算活跃和奖励
GAMEMAIL = 'Mail',
}

68
shared/db/GMMail.ts Normal file
View File

@@ -0,0 +1,68 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
import { nowSeconds } from '../pubUtils/timeUtil';
import { now } from 'moment';
class RewardInter {
id: number;
count: number;
}
class SendRole {
@prop({ required: true })
roleId: string;
@prop({ required: true })
status: number;
}
export default class GMMail extends BaseModel {
@prop({ required: true })
serverId: number;
@prop({ required: true })
sendRoles: SendRole[];
@prop({ required: true, type: RewardInter, default: [], _id: false })
goods: RewardInter[];
@prop({ required: true, default: nowSeconds() })
sendTime: number;
@prop({ required: true })
endTime: number;
@prop({ required: true })
content: string;
@prop({ required: true })
sendName: string;
@prop({ required: true })
gmMailType: number; //1:群体邮件2分服务器邮件
public static async addMail(params: {serverId: number, sendRoles: SendRole[], sendName: string, endTime: number, content: string, gmMailType: number, sendTime?: number, goods?: RewardInter[] }) {
const doc = new GMMailModel();
const mail = Object.assign(doc.toJSON(), params);
await GMMailModel.create(mail);
return mail;
}
public static async getGmMailById(_id: string, lean = true) {
const result: GMMailType = await GMMailModel.findOne({ _id }).lean(lean);
return result;
}
public static async getMail(updatedMailAt: number, lean = true) {
const result: GMMailType[] = await GMMailModel.find({ $or: [{updatedAt: { $gte: new Date(updatedMailAt) }}, {sendTime: { $lte: nowSeconds() }}], endTime: { $gte: nowSeconds()} }).lean(lean);
return result;
}
public static async getMails( lean = true) {
const result: GMMailType[] = await GMMailModel.find({ endTime: { $gte: nowSeconds() }}).lean(lean);
return result;
}
}
export const GMMailModel = getModelForClass(GMMail);
export interface GMMailType extends Pick<DocumentType<GMMail>, keyof GMMail> { };

109
shared/db/GroupMail.ts Normal file
View File

@@ -0,0 +1,109 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
import { nowSeconds } from '../pubUtils/timeUtil';
import { SrvRecord } from 'dns';
import { MAIL_STATUS } from '../consts/constModules/mailConst';
import { select } from 'underscore';
class RewardInter {
id: number;
count: number;
}
class SendRole {
@prop({ required: true })
roleId: string;
@prop({ required: true })
status: number;
}
@index({ sendRoles: 1 })
@index({ mailId: 1, type: 1 })
export default class GroupMail extends BaseModel {
@prop({ required: true })
sendRoles: SendRole[];
@prop({ required: true })
mailId: string;
@prop({ required: true, type:RewardInter, default: [], _id: false})
goods: RewardInter[];
@prop({ required: true, default: nowSeconds() })
sendTime: number;
@prop({ required: true, default: nowSeconds() })
endTime: number;
@prop({ required: true })
params: string[];
@prop({ required: true })
mailTemType: number; //1:表示模板邮件2表示系统邮件
@prop({ required: true })
sendName: string;
public static async addGroupMails(mails: Array<GroupMailType>) {
await GroupMailModel.insertMany(mails);
}
public static async addGroupMail(params:{ sendRoles: SendRole[],mailId: string, mailTemType:number, goods?: Array<RewardInter>, sendName?: string, endTime?:number, sendTime?: number, params?:string[] }) {
const doc = new GroupMailModel();
const mail = Object.assign(doc.toJSON(), params);
await GroupMailModel.create(mail);
return mail;
}
public static async getGroupMailsByRoleId(roleId: string, lean = true) {
const result: GroupMailType[] = await GroupMailModel.findOne({ 'sendRoles.roleId': roleId, 'sendRoles.status': { $ne: -1}, endTime: { $gte: nowSeconds() }}).lean(lean);
return result;
}
public static async getMail( mailId: string, mailTemType: number, lean = true) {
const result: GroupMailType = await GroupMailModel.findOne({ mailId, mailTemType }).lean(lean);
return result;
}
public static async pushRoleMail( roleId: string, mailId: string, mailTemType: number, lean = true) {
const result: GroupMailType = await GroupMailModel.findOneAndUpdate({ mailId, mailTemType }, {$push: {sendRoles: {roleId, status: 0}}}).lean(lean);
return result;
}
public static async getMailById(_id: string, lean = true) {
const result: GroupMailType = await GroupMailModel.findOne({ _id }).lean(lean);
return result;
}
public static async updateMailByStatus(_id: string, roleId: string, status: number, conditions: number[], lean = true) {
const result: GroupMailType = await GroupMailModel.findOneAndUpdate({ _id, 'sendRoles.roleId': roleId, 'sendRoles.status': {$in: conditions} }, {$set:{ 'sendRoles.$.status': status }}, { new: true }).lean(lean);
return result;
}
public static async deleteMail(_id: string, roleId: string, status: number, lean = true) {
const result: GroupMailType = await GroupMailModel.findOneAndUpdate({ _id, 'sendRoles.roleId': roleId, }, {$set:{ 'sendRoles.$.status': status }}, { new: true }).lean(lean);
return result;
}
public static async findReadAndRewardsMails(roleId: string, lean = true) {
const ids: string[] = await GroupMailModel.find({ 'sendRoles.roleId': roleId, $or:[ {$and: [{'sendRoles.status': MAIL_STATUS.READ, goods: []}]}, {'sendRoles.status': MAIL_STATUS.RECEIVED}] }).select('_id').lean(lean);
return ids;
}
public static async updateMailStatus(ids: string[], status: number, roleId: string) {
const result: GroupMailType[] = await GroupMailModel.update({_id: {$in: ids}, 'sendRoles.roleId': roleId}, { $set:{ 'sendRoles.$.status': status } });
return result;
}
public static async delMail(_id: string, roleId: string, lean = true) {
const result: GroupMailType = await GroupMailModel.findOneAndUpdate({ _id, 'sendRoles.roleId': roleId, $or:[ {$and: [{'sendRoles.status': MAIL_STATUS.READ, goods: []}]}, {'sendRoles.status': MAIL_STATUS.RECEIVED}] }, { $set:{ 'sendRoles.$.status': MAIL_STATUS.DELETE } }, { new: true }).lean(lean);
return result;
}
public static async findRewardsMails(roleId: string, lean = true) {
const result: GroupMailType[] = await GroupMailModel.find({ 'sendRoles.roleId': roleId, $and: [{'sendRoles.status': MAIL_STATUS.READ, goods: {$ne: []}}] }).select('_id goods').lean(lean);
return result;
}
}
export const GroupMailModel = getModelForClass(GroupMail);
export interface GroupMailType extends Pick<DocumentType<GroupMail>, keyof GroupMail>{}
export type GroupMailTypeParam = Partial<GroupMailType>; // 将所有字段变成可选项

View File

@@ -1,46 +1,98 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
import { nowSeconds } from '../pubUtils/timeUtil';
import { MAIL_STATUS } from '../consts/constModules/mailConst';
class RewardInter {
id: number;
count: number;
}
@index({ roleId: 1 })
@index({ roleId: 1, mailId: 1, type: 1 })
export default class Mail extends BaseModel {
@prop({ required: true })
roleId: string;
@prop({ required: true })
mailId: number;
mailId: string;
@prop({ required: true, type:RewardInter, default: [], _id: false})
@prop({ required: true, type: RewardInter, default: [], _id: false })
goods: RewardInter[];
@prop({ required: true, default: nowSeconds() })
sendTime: number;
@prop({ required: true, default: "" })
sendName: string;
@prop({ required: true, default: nowSeconds() })
sendTime: number;
@prop({ required: true })
content: string;
params: string[];
@prop({ required: true, default: 0 })
status: number;
@prop({ required: true, default: MAIL_STATUS.CREATE })
status: number;
@prop({ required: true })
mailTemType: number; //1:表示模板邮件2表示系统邮件
@prop({ required: true })
sendName: string;
@prop({ required: true })
endTime: number;
public static async addMails(mails: Array<MailType>) {
await MailModel.insertMany(mails);
}
public static async addMail(params:{ roleId: string, goods: Array<RewardInter>, sendName: string, mailId: number, sendTime?: number, content?:string }) {
public static async addMail(params: { roleId: string, goods: Array<RewardInter>, sendName: string, mailId: string, endTime: number, mailTemType: number, params?: string[], sendTime?: number }) {
const doc = new MailModel();
const mail = Object.assign(doc.toJSON(), params);
await MailModel.create(mail);
return mail;
}
public static async getMailsByRoleId(roleId: string, lean = true) {
const result: MailType[] = await MailModel.find({ roleId, status: { $ne: -1 } }).lean(lean);
return result;
}
public static async getMail(roleId: string, mailId: string, mailTemType: number, lean = true) {
const result: MailType = await MailModel.findOne({ roleId, mailId, mailTemType }).lean(lean);
return result;
}
public static async getMailById(_id: string, lean = true) {
const result: MailType = await MailModel.findOne({ _id }).lean(lean);
return result;
}
public static async updateMailByStatus(_id: string, conditions: number[], update: MailTypeParam, lean = true) {
const result: MailType = await MailModel.findOneAndUpdate({ _id, status: { $in: conditions } }, { $set: update }, { new: true }).lean(lean);
return result;
}
public static async updateMail(_id: string, update: MailTypeParam, lean = true) {
const result: MailType = await MailModel.findOneAndUpdate({ _id }, { $set: update }, { new: true }).lean(lean);
return result;
}
public static async findReadAndRewardsMails(roleId: string, lean = true) {
const ids: string[] = await MailModel.find({ roleId, $or: [{ $and: [{ status: MAIL_STATUS.READ, goods: [] }] }, { status: MAIL_STATUS.RECEIVED }] }).select('_id').lean(lean);
return ids;
}
public static async updateMailStatus(ids: string[], status: number) {
await MailModel.update({ _id: { $in: ids } }, { $set: { status } });
}
public static async delMail(_id: string, lean = true) {
const result: MailType = await MailModel.findOneAndUpdate({ _id, $or: [{ $and: [{ status: MAIL_STATUS.READ, goods: [] }] }, { status: MAIL_STATUS.RECEIVED }] }, { $set: { status: MAIL_STATUS.DELETE } }, { new: true }).lean(lean);
return result;
}
public static async findRewardsMails(roleId: string, lean = true) {
const result: MailType[] = await MailModel.find({ roleId, $and: [{ status: MAIL_STATUS.READ, goods: { $ne: [] } }] }).select('_id goods').lean(lean);
return result;
}
}
export const MailModel = getModelForClass(Mail);
export interface MailType extends Pick<DocumentType<Mail>, keyof Mail> { };
export interface MailType extends Pick<DocumentType<Mail>, keyof Mail> { };
export type MailTypeParam = Partial<MailType>; // 将所有字段变成可选项

View File

@@ -224,7 +224,8 @@ export default class Role extends BaseModel {
blockCnt: number; // 黑名单人数
@prop({ required: true, default: 0 })
recFrdApplyCnt: number; // 玩家收取好友申请数量
@prop({ required: true, default: 0 })
updatedMailAt: number;
public static async findAllByUid(uid: number, lean = true) {
const role: RoleType[] = await RoleModel.find({ 'userInfo.uid': uid }).select('roleId roleName serverId').lean(lean);
return role;

View File

@@ -7,14 +7,16 @@ export interface DicMail {
readonly id: number;
// 内容 %d 替换
readonly content: string;
readonly time: number;
}
const str = readJsonFile(FILENAME.DIC_MAIL);
let arr = JSON.parse(str);
export const dicMail = new Map<number, string>();
export const dicMail = new Map<number, DicMail>();
arr.forEach(o => {
dicMail.set(o.id, o.content);
o.time = o.time * 24 * 60 * 60;
dicMail.set(o.id, o);
});
arr = undefined;

View File

@@ -57,6 +57,8 @@ export interface DicBossBase {
readonly reward: RewardInter[];
readonly consume: number;
readonly opencost: number;
}
const DicBossKeys: KeysEnum<DicBossBase> = {
@@ -65,7 +67,8 @@ const DicBossKeys: KeysEnum<DicBossBase> = {
bossLevel: true,
wars: true,
reward: true,
consume: true
consume: true,
opencost: true
};
// 练兵场

View File

@@ -0,0 +1,38 @@
import { mailInit, setMails, GMMail } from '../gmData/gmMail';
import { nowSeconds } from '../timeUtil';
const ALL_SERVER = 0;
export let gmData:any = {};
export async function init() {
gmData.mails = await mailInit();
}
export function getGmMails(updatedMailAt: number, serverId: number) {
let list = [];
let serverIds = [serverId, ALL_SERVER];
for (let serverId of serverIds) {
if (!gmData.mails.get(serverId))
continue;
gmData.mails.get(serverId).map(({updatedAt, sendTime, endTime, id, sendRoles, goods, content, gmMailType})=>{
if (updatedAt >= updatedMailAt || sendTime > updatedMailAt || endTime < nowSeconds() )
list.push({updatedAt, sendTime, endTime, id, sendRoles, goods, content, gmMailType});
});
}
return list;
}
export function getGmMailById(id: string, serverId: number) {
let gmMail;
if (!!gmData.mails.get(serverId)) {
gmMail = gmData.mails.get(serverId).get(id);
}
if (!gmMail) {
if (!!gmData.mails.get(ALL_SERVER)) {
gmMail = gmData.mails.get(ALL_SERVER).get(id);
}
}
return gmMail;
}
export function setGmMails(mails: GMMail[]) {
setMails(mails, gmData.mails);
}

View File

@@ -0,0 +1,59 @@
type KeysEnum<T> = { [P in keyof Required<T>]: true };
import { RewardInter } from '../interface';
import { GMMailModel } from '../../db/GMMail';
const _ = require('lodash');
export interface GMMail {
readonly id: string;
readonly sendRoles?: Array<{roleId: string, status: number}>;
readonly goods: Array<RewardInter>;
readonly sendTime: number;
readonly endTime: number;
readonly content: string;
readonly gmMailType: number;
readonly updatedAt: number;
readonly serverId: number;
readonly sendName: string;
}
const GMMailKeys: KeysEnum<GMMail> = {
id: true,
sendRoles: true,
goods: true,
sendTime: true,
endTime: true,
content: true,
gmMailType: true,
updatedAt: true,
serverId: true,
sendName: true
};
export async function mailInit() {
let gmMail = new Map<number, any>();
let mails = await GMMailModel.getMails();
mails.map((o:any)=>{
o.id = o._id;
o.updatedAt = Math.floor(o.updatedAt.getTime()/1000);
let mail = gmMail.get(o.serverId);
if (!mail)
mail = new Map<string, GMMail>();
mail.set(o._id, _.pick(o, Object.keys(GMMailKeys)));
gmMail.set(o.serverId, mail);
});
return gmMail;
}
export function setMails(mails:GMMail[], gmMail) {
mails.map((o:any)=>{
o.id = o._id;
o.updatedAt = Math.floor(o.updatedAt.getTime()/1000);
let mail = gmMail.get(o.serverId);
if (!mail)
mail = new Map<string, GMMail>();
mail.set(o._id, _.pick(o, Object.keys(GMMailKeys)));
gmMail.set(o.serverId, mail);
});
}

View File

@@ -104,6 +104,18 @@ export interface Uid {
export interface pushMail {
route: string;
data:any[];
uids:Uid[];
}
data: mailData[];
uids: Uid[];
}
export interface mailData {
id: string;
mailId: string;
goods: RewardInter[];
sendTime: number;
endTime: number;
content: string;
status: number;
mailType: number;
sendName: string;
}

View File

@@ -0,0 +1,67 @@
[
{
"id": 1,
"content": "您对军团%d的申请被拒绝",
"time": 24
},
{
"id": 2,
"content": "由于被弹劾,您在军团%d的大将军职务已卸任",
"time": 24
},
{
"id": 3,
"content": "您被任命为军团%d的大将军",
"time": 24
},
{
"id": 4,
"content": "您被军团%d踢出",
"time": 24
},
{
"id": 5,
"content": "周活跃分成奖励",
"time": 24
},
{
"id": 6,
"content": "您被任命为军团%d的管理",
"time": 24
},
{
"id": 7,
"content": "您已卸任军团%d的管理",
"time": 24
},
{
"id": 8,
"content": "小将军您的军团已开启boss%d请赶往支援",
"time": 24
},
{
"id": 9,
"content": "恭喜小将军军团上下一心已成功压制boss%d您在此次压制中的排名为第%d名获得如下奖励",
"time": 24
},
{
"id": 10,
"content": "小将军,您在上周军团练兵场中有奖励尚未领取,奖励如下:",
"time": 24
},
{
"id": 11,
"content": "小将军,%d赠送您一个%d请查收",
"time": 24
},
{
"id": 12,
"content": "亲爱的小将军,您在%d赛季结算奖励如下:",
"time": 24
},
{
"id": 13,
"content": "恭喜小将军,您在%d赛季最终获得了第%d名获得如下奖励",
"time": 24
}
]