From ddc980456be97cde945d8fc3413cfbe38bb5fd48 Mon Sep 17 00:00:00 2001 From: luying Date: Sat, 2 Jul 2022 13:51:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E9=97=ADsdk=E5=B1=8F=E8=94=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/servers/connector/filter/global.ts | 3 ++- game-server/app/services/utilService.ts | 6 ++++++ shared/pubUtils/sdkUtil.ts | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 game-server/app/services/utilService.ts diff --git a/game-server/app/servers/connector/filter/global.ts b/game-server/app/servers/connector/filter/global.ts index ced1c5542..40cb772d3 100644 --- a/game-server/app/servers/connector/filter/global.ts +++ b/game-server/app/servers/connector/filter/global.ts @@ -10,6 +10,7 @@ import { errlogger } from "../../../util/logger"; import { gameData } from "../../../pubUtils/data"; import { sendMessageToUser } from "../../../services/pushService"; import { isCheckWord } from "../../../pubUtils/sdkUtil"; +import { isDevelopEnv } from "../../../services/utilService"; export function globalFilter(app: Application) { return new Filter(app); } @@ -105,7 +106,7 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se } let hasBlockWords = false; - if(isCheckWord()) { + if(isCheckWord(isDevelopEnv())) { switch(routeRecord.route) { case 'chat.chatHandler.sendPrivateMessage': { diff --git a/game-server/app/services/utilService.ts b/game-server/app/services/utilService.ts new file mode 100644 index 000000000..90a0d1853 --- /dev/null +++ b/game-server/app/services/utilService.ts @@ -0,0 +1,6 @@ +import { pinus } from "pinus"; + +export function isDevelopEnv() { + const envs = ['development', 'monitor'] + return envs.indexOf(pinus.app.get('env')) != -1; +} \ No newline at end of file diff --git a/shared/pubUtils/sdkUtil.ts b/shared/pubUtils/sdkUtil.ts index c5daacd68..0f07b3e9b 100644 --- a/shared/pubUtils/sdkUtil.ts +++ b/shared/pubUtils/sdkUtil.ts @@ -155,6 +155,6 @@ export function isDebugPay() { return gameData.serverConst.DEBUG_PAY === 1; } -export function isCheckWord() { - return gameData.serverConst.CHECK_WORD === 1; +export function isCheckWord(isDevelop = false) { + return gameData.serverConst.CHECK_WORD === 1 && !isDevelop; } \ No newline at end of file