军团:屏蔽词

This commit is contained in:
luying
2021-08-24 16:44:38 +08:00
parent 0bc333bfa8
commit dc798c7bfa
@@ -26,10 +26,10 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
let maintenServers = await pinus.app.rpc.connector.connectorRemote.getServerMainten.toServer(id); let maintenServers = await pinus.app.rpc.connector.connectorRemote.getServerMainten.toServer(id);
if(maintenServers.indexOf(serverId) != -1) { // 该服务器维护 if(maintenServers.indexOf(serverId) != -1) { // 该服务器维护
let isWhiteList = await checkWhiteListWithUid(uid); let isWhiteList = await checkWhiteListWithUid(uid);
if(isWhiteList) next(null); if(isWhiteList) return next(null);
pinus.app.get('channelService').pushMessageByUids('onServerMaintenance', resResult(STATUS.SERVER_MAINTENANCE), [{ uid: roleId, sid }]); pinus.app.get('channelService').pushMessageByUids('onServerMaintenance', resResult(STATUS.SERVER_MAINTENANCE), [{ uid: roleId, sid }]);
next(new Error(), resResult(STATUS.SERVER_MAINTENANCE)); return next(new Error(), resResult(STATUS.SERVER_MAINTENANCE));
} }
let hasBlockWords = false; let hasBlockWords = false;
@@ -40,7 +40,7 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
} else if (routeRecord.route == 'role.roleHandler.rename') { } else if (routeRecord.route == 'role.roleHandler.rename') {
hasBlockWords = await checkFilterWords(msg.roleName); hasBlockWords = await checkFilterWords(msg.roleName);
} }
if(hasBlockWords) next(new Error(), resResult(STATUS.BLOCK_WORDS)); if(hasBlockWords) return next(new Error(), resResult(STATUS.BLOCK_WORDS));
next(null); next(null);
}; };