From a135c5fc99401b608b2fa8a58f0940a02b83ee1d Mon Sep 17 00:00:00 2001 From: zhangxk Date: Mon, 10 Jul 2023 13:48:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=AE=9E=E6=97=B6=E5=B0=81=E5=8F=B7):?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E9=BB=98=E8=AE=A4=E5=B0=81=E5=8F=B7?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=98=AF=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle/handler/normalBattleHandler.ts | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/game-server/app/servers/battle/handler/normalBattleHandler.ts b/game-server/app/servers/battle/handler/normalBattleHandler.ts index 361edabe3..4828a961f 100644 --- a/game-server/app/servers/battle/handler/normalBattleHandler.ts +++ b/game-server/app/servers/battle/handler/normalBattleHandler.ts @@ -558,7 +558,7 @@ export class NormalBattleHandler { * @param {number} type 查封类型(封除类型不为200) * @returns */ - async blockByRecordBattleCheat(roleId: string, type: number, sid:string) { + async blockByRecordBattleCheat(roleId: string, type: number, sid: string) { if (roleId == undefined || type == undefined || sid == undefined) { return; } @@ -568,25 +568,27 @@ export class NormalBattleHandler { } // 设置redis开关 - const isCheckBlock = await redisClient().getAsync(REDIS_KEY.IS_CHECT_BLOCK); + let isCheckBlock = await redisClient().getAsync(REDIS_KEY.IS_CHECT_BLOCK); if (!isCheckBlock || isCheckBlock == undefined) { - await redisClient().setAsync(REDIS_KEY.IS_CHECT_BLOCK, `${CHECT_BLOCK_TYPE.OPEN}`);; + //首次写入 默认是关 + await redisClient().setAsync(REDIS_KEY.IS_CHECT_BLOCK, `${CHECT_BLOCK_TYPE.CLOSE}`); + isCheckBlock = CHECT_BLOCK_TYPE.CLOSE.toString(); } - if (isCheckBlock && parseInt(isCheckBlock) != CHECT_BLOCK_TYPE.OPEN) { + + // 仅当为open状态才执行封号 + if(isCheckBlock && parseInt(isCheckBlock) == CHECT_BLOCK_TYPE.OPEN){ + const blockType: BLOCK_TYPE = BLOCK_TYPE.BLOCK; + const blockReason: string = "使用第三方软件, 封停账号, 封停时间为:" + new Date();; + let role = await RoleModel.updateRoleInfo(roleId, { blockType, blockReason }); + if (!role) return resResult(STATUS.ROLE_NOT_FOUND); + + await this.app.rpc.connector.connectorRemote.setOtherUserSession.toServer(sid, [{ roleId, blockType }]); + await this.app.rpc.connector.connectorRemote.remoteLogin.toServer(sid, roleId, STATUS.BLOCKED); + await roleLeave(roleId); + }else{ console.log("blockByRecordBattleCheat-防破解查封功能已关闭!!!"); - return; } - const blockType: BLOCK_TYPE = BLOCK_TYPE.BLOCK; - const blockReason: string = "使用第三方软件, 封停账号, 封停时间为:" + new Date();; - let role = await RoleModel.updateRoleInfo(roleId, { blockType, blockReason }); - if (!role) return resResult(STATUS.ROLE_NOT_FOUND); - - await this.app.rpc.connector.connectorRemote.setOtherUserSession.toServer(sid, [{ roleId, blockType }]); - await this.app.rpc.connector.connectorRemote.remoteLogin.toServer(sid, roleId, STATUS.BLOCKED); - await roleLeave(roleId); - - return; } }