优化:抽象推送方法

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

@@ -6,12 +6,13 @@ import { RewardInter } from "../../pubUtils/interface";
import { getRaceEventItems, gameData } from "../../pubUtils/data";
import { GuildModel } from "../../db/Guild";
import { sendSingleRaceActEndMsg } from "./guildActivityService";
import { REDIS_KEY, RACE_EVENT_TYPE, RACE_EVENT_EFFECT_TYPE, RACE_EVENT, STATUS, RACE_ACTIVITY_STATUS } from "../../consts";
import { REDIS_KEY, RACE_EVENT_TYPE, RACE_EVENT_EFFECT_TYPE, RACE_EVENT, STATUS, RACE_ACTIVITY_STATUS, PUSH_ROUTE } from "../../consts";
import { getGuildChannelSid } from "../chatService";
import { pinus } from "pinus";
import { getRandEelm, sortArrRandom, resResult, getRandResultByMember } from "../../pubUtils/util";
import { Rank } from "../rankService";
import { getTimeFun } from "../../pubUtils/timeUtil";
import { sendMessageToGuildWithSuc } from "../pushService";
// 粮草先行
export class RaceActivityObject {
@@ -101,9 +102,7 @@ export class RaceActivityObject {
events.push(event);
this.events.set(toGuild, events);
}
let chatSid = await getGuildChannelSid(toGuild);
pinus.app.rpc.chat.guildRemote.sendRaceEvent.toServer(chatSid, toGuild, [event]);
await sendMessageToGuildWithSuc(toGuild, PUSH_ROUTE.GUILD_RACE_EVENT, { timestamp: Date.now(), events: [event] });
return event;
}