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

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

View File

@@ -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';
}
// 解密接口

View File

@@ -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) {

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,

View File

@@ -39,6 +39,8 @@ export interface DicServerConst {
readonly TIME_STAMP_OVER: number;
// 请求参数过期时间
readonly ACCESS_CODE_EXPIRE_TIME: number;
// 是否跳过加密
readonly SKIP_ENCODE: number;
}
export const dicServerConst: DicServerConst = {} as DicServerConst;

View File

@@ -161,4 +161,8 @@ export function isCheckWord(isDevelop = false) {
export function canPay() {
return gameData.serverConst.CAN_PAY === 1;
}
export function isSkipEncode(isDevelop = false) {
return gameData.serverConst.SKIP_ENCODE === 1 && isDevelop;
}

View File

@@ -21,5 +21,6 @@
"DEBUG_PAY": 0,
"DEBUG_TIME": 1,
"CHECK_WORD": 1,
"CAN_PAY": 1
"CAN_PAY": 1,
"SKIP_ENCODE": 0
}