优化:抽象推送方法

This commit is contained in:
luying
2022-04-08 20:38:54 +08:00
parent a64faac7cd
commit f486a8d8a5
38 changed files with 475 additions and 1257 deletions

View File

@@ -18,6 +18,7 @@ import _ = require("underscore");
import { getGoldObject } from "./role/rewardService";
import { SurveyRecModel } from "../db/SurveyRec";
import { SurveyModel } from "../db/Survery";
import { pushGuildInfoUpdate } from "./guildService";
// 检查私聊是否合法
@@ -142,8 +143,7 @@ export async function treatGuildName(content: string) {
await GuildModel.updateInfo(params.code, { name: newName, sdkMark: false });
// 通知处理
await sendMailToGuildByContent(MAIL_TYPE.TREAT_GUILD_INFO, params.code, {}); // 邮件
let chatSid = await getGuildChannelSid(params.code);
pinus.app.rpc.chat.guildRemote.updateInfo.toServer(chatSid, params.code, { name: newName }); // 军团推送
await pushGuildInfoUpdate(params.code, { name: newName });
await updateUserInfo(REDIS_KEY.GUILD_INFO, params.code, [{ field: 'name', value: newName }]); // redis缓存信息
for(let roleId of guild.members) {
await updateUserInfo(REDIS_KEY.USER_INFO, roleId, [{ field: 'guildName', value: newName }]);
@@ -155,8 +155,7 @@ export async function treatGuildName(content: string) {
await GuildModel.updateInfo(params.code, { notice: ' ', sdkMark: false });
// 通知处理
await sendMailToGuildByContent(MAIL_TYPE.TREAT_GUILD_INFO, params.code, {}); // 邮件
let chatSid = await getGuildChannelSid(params.code);
pinus.app.rpc.chat.guildRemote.updateInfo.toServer(chatSid, params.code, { notice: '' }); // 军团推送
await pushGuildInfoUpdate(params.code, { notice: '' });
}
}
}