推送:对单人推送函数抽象
This commit is contained in:
@@ -3,12 +3,13 @@ import {Application, RouteRecord, FrontendOrBackendSession, HandlerCallback, pin
|
||||
import { refresh } from '../../../services/refreshService';
|
||||
import { checkPrivateChat, checkGuildChat, checkOtherChat, checkRoleName, checkGuildName } from "../../../services/sdkService";
|
||||
import { resResult, checkWhiteList, genCode } from "../../../pubUtils/util";
|
||||
import { BLOCK_TYPE, CHANNEL_PREFIX, MSG_TYPE, STATUS } from "../../../consts";
|
||||
import { BLOCK_TYPE, CHANNEL_PREFIX, MSG_TYPE, PUSH_ROUTE, STATUS } from "../../../consts";
|
||||
import { SERVER_DEBUG_MODE } from "../../../pubUtils/dicParam";
|
||||
import { nowSeconds } from "../../../pubUtils/timeUtil";
|
||||
import { getServerMainten } from "../../../services/gmService";
|
||||
import { errlogger } from "../../../util/logger";
|
||||
import { gameData } from "../../../pubUtils/data";
|
||||
import { sendMessageToUser, sendMessageToUserWithSuc } from "../../../services/pushService";
|
||||
export function globalFilter(app: Application) {
|
||||
return new Filter(app);
|
||||
}
|
||||
@@ -98,7 +99,7 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
|
||||
let isWhiteList = await checkWhiteList(this.app.get('env'), ip, uid, serverId);
|
||||
if(isWhiteList) return next(null);
|
||||
|
||||
pinus.app.get('channelService').pushMessageByUids('onServerMaintenance', resResult(STATUS.SERVER_MAINTENANCE), [{ uid: roleId, sid }]);
|
||||
sendMessageToUser(roleId, PUSH_ROUTE.SERVER_MAINTENANCE, resResult(STATUS.SERVER_MAINTENANCE), sid);
|
||||
return next(new Error('globalFilter'), resResult(STATUS.SERVER_MAINTENANCE));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user