邮件:修改邮件逻辑

This commit is contained in:
luying
2021-06-28 13:31:29 +08:00
parent 2ffe0f7890
commit 3b1d458a87
29 changed files with 932 additions and 626 deletions
@@ -9,6 +9,7 @@ import { getWorldChannelSid, groupRoomId } from '../../../services/chatService';
import { reloadResources } from '../../../pubUtils/data';
import { GeneralRankParamRole, GeneralRankParamBattle } from '../../../domain/rank';
import { getAllGuildActivityStatus } from '../../../services/guildActivityService';
import { MailParam } from '../../../domain/roleField/mail';
export default function (app: Application) {
return new ChatRemote(app);
@@ -225,4 +226,17 @@ export class ChatRemote {
let guildActivities = getAllGuildActivityStatus();
channel.pushMessage(this.GUILD_ACTIVITY_STATUS_UPDATE, resResult(STATUS.SUCCESS, { guildActivities }));
}
/**
* 向全服推送邮件
* @param serverId 服务器id
* @param path 推送地址
* @param mails 邮件内容
*/
public async sendMail(serverId: number, path: string, data: { mails: MailParam[] }) {
let roomId = groupRoomId(CHANNEL_PREFIX.WORLD, serverId);
let channel = this.channelService.getChannel(roomId, false);
if (!channel) return;
channel.pushMessage(path, resResult(STATUS.SUCCESS, data));
}
}
@@ -6,6 +6,7 @@ import { RoleType } from '../../../db/Role';
import { GuildRecType } from '../../../db/GuildRec';
import { leaveGuildChannel, groupRoomId } from '../../../services/chatService';
import { GuildRankParams, WoodenHorse, Event } from '../../../domain/battleField/guildActivity';
import { MailParam } from '../../../domain/roleField/mail';
export default function (app: Application) {
return new GuildRemote(app);
@@ -35,6 +36,7 @@ export class GuildRemote {
private GUILD_RACE_UPDATE = 'onRaceHorseUpdate'; /// 更新木牛流马
private GUILD_RACE_EVENT = 'onRaceEventUpdate'; /// 更新木牛流马
private GUILD_POP_UP_ACTIVITY = 'onActivityUpdate'; /// 向军团成员发送弹窗礼包
private GUILD_TRAIN_RESET = 'onGuildTainReset'; // 试炼场重置
/**
* 封装,军团相关channel名: 'guild'+guildCode
@@ -285,11 +287,26 @@ export class GuildRemote {
}
/**
* @description 向军团推送弹窗礼包数据活动
* @param guildCode
*/
* @description 向军团推送弹窗礼包数据活动
* @param guildCode
*/
public async sendPopUpActivity(guildCode: string, data: any[]) {
console.log("sendPopUpActivity")
this.pushMessage(guildCode, this.GUILD_POP_UP_ACTIVITY, data);
}
/**
* @description 军团邮件
* @param guildCode 军团code
* @param path 推送地址
* @param data 军团内容
*/
public async sendMailToGuild(guildCode: string, path: string, data: { mails: MailParam[]}) {
this.pushMessage(guildCode, path, data);
}
public async sendTrainReset(guildCode: string) {
this.pushMessage(guildCode, this.GUILD_TRAIN_RESET, {});
}
}