feat(防破解): 去除无需的io操作
This commit is contained in:
@@ -539,13 +539,14 @@ export class NormalBattleHandler {
|
||||
const { dataId, type, iKey, value, secV } = msg;
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let sid = session.get('sid');
|
||||
|
||||
const rec = await BattleCheatRecModel.createRecord(dataId, type, iKey, value, secV, roleId, roleName);
|
||||
if (!rec) {
|
||||
return resResult(STATUS.BATTLE_CHECK_REC_SAVE_ERR);
|
||||
}
|
||||
|
||||
await this.blockByRecordBattleCheat(roleId, type);
|
||||
await this.blockByRecordBattleCheat(roleId, type, sid);
|
||||
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
@@ -557,8 +558,8 @@ export class NormalBattleHandler {
|
||||
* @param {number} type 查封类型(封除类型不为200)
|
||||
* @returns
|
||||
*/
|
||||
async blockByRecordBattleCheat(roleId: string, type: number) {
|
||||
if(roleId == undefined || type == undefined){
|
||||
async blockByRecordBattleCheat(roleId: string, type: number, sid:string) {
|
||||
if (roleId == undefined || type == undefined || sid == undefined) {
|
||||
return;
|
||||
}
|
||||
if (type && type === CHECT_BATTLE_TYPE) {
|
||||
@@ -581,12 +582,10 @@ export class NormalBattleHandler {
|
||||
let role = await RoleModel.updateRoleInfo(roleId, { blockType, blockReason });
|
||||
if (!role) return resResult(STATUS.ROLE_NOT_FOUND);
|
||||
|
||||
let { isOnline, sid } = await getRoleOnlineInfo(roleId);
|
||||
if (isOnline) {
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user