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; } }