加密:增加可以选择不加密

This commit is contained in:
luying
2022-07-29 11:26:28 +08:00
parent 2806fdd9b1
commit 45802ba9e1
6 changed files with 15 additions and 6 deletions
@@ -10,7 +10,7 @@ import { getServerMainten } from "../../../services/gmService";
import { errlogger, infologger } from "../../../util/logger";
import { gameData } from "../../../pubUtils/data";
import { sendMessageToUser } from "../../../services/pushService";
import { isCheckWord } from "../../../pubUtils/sdkUtil";
import { isCheckWord, isSkipEncode } from "../../../pubUtils/sdkUtil";
import { isDevelopEnv } from "../../../services/utilService";
import { isNumber } from "underscore";
import { redisClient } from "../../../services/redisService";
@@ -53,7 +53,7 @@ class Filter {
if(!this.checkFunction(routeRecord.route)) {
return next(new Error('globalFilter'), resResult(STATUS.FUNCTION_CLOSE, { route: routeRecord.route }));
}
if(!checkRouteParam(routeRecord.route, msg)) {
return next(new Error('globalFilter'), resResult(STATUS.WRONG_PARMS, { route: routeRecord.route }));
}
@@ -140,7 +140,7 @@ class Filter {
// 这个接口是否需要加密解密
private checkPassEncrypt (route: string) {
return route.startsWith('gm.') || route == 'connector.entryHandler.gmEnter';
return isSkipEncode(isDevelopEnv()) || route.startsWith('gm.') || route == 'connector.entryHandler.gmEnter' || route == 'gate.gateHandler.queryEntry';
}
// 解密接口
@@ -1,6 +1,6 @@
import { STATUS } from './../../../consts/statusCode';
import { dispatch } from '../../../pubUtils/dispatcher';
import { Application, BackendSession, HandlerService, } from 'pinus';
import { Application, BackendSession, HandlerService, pinus, } from 'pinus';
import { resResult } from '../../../pubUtils/util';
export default function (app: Application) {
+3 -1
View File
@@ -5,6 +5,8 @@ import { getCityChannelSid, getGuildChannelSid, getWorldChannelSid, groupRoomId
import { getAllOnlineRoles, getRoleOnlineInfo } from "./redisService";
import { errlogger, infologger } from '../util/logger';
import { MsgEncrypt } from "../pubUtils/sysUtil";
import { isSkipEncode } from "../pubUtils/sdkUtil";
import { isDevelopEnv } from "./utilService";
export async function sendMessageToAllWithSuc(route: string, data: any, filterCb?: ({ lv, topLineupCe }) => boolean) {
await sendMessageToAll(route, resResult(STATUS.SUCCESS, data), filterCb);
@@ -181,7 +183,7 @@ function encryptMsg(event: string, json: any) {
}
function checkNotEncryptRoute(event: string) {
return [
return isSkipEncode(isDevelopEnv()) || [
PUSH_ROUTE.PUSH_CURRENT_TIME,
PUSH_ROUTE.RACE_START,
PUSH_ROUTE.GUILD_ACTIVITY_END,