邮件 活跃度下发
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -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 })=>{
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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}`)
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
18
game-server/app/services/refreshService.ts
Normal file
18
game-server/app/services/refreshService.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user