🐞 fix(防加速): 添加校验参数

This commit is contained in:
luying
2023-08-16 19:12:13 +08:00
parent 7c3a98bb9d
commit 55e3310f31
3 changed files with 10 additions and 12 deletions

View File

@@ -449,10 +449,10 @@ export class ComBattleHandler {
* @returns
* @memberof ComBattleHandler
*/
async action(msg: {teamCode: string, bossHurts: Array<{hid: number, dataId: number, hurtHp: number}>, killed: number[], curRnd: number, timegap: number }, session: BackendSession) {
async action(msg: {teamCode: string, bossHurts: Array<{hid: number, dataId: number, hurtHp: number}>, killed: number[], curRnd: number, timegap: number, roundTime: number }, session: BackendSession) {
let roleId = session.get('roleId');
let sid = session.get('sid');
let { teamCode, killed, bossHurts, curRnd, timegap = 0 } = msg;
let { teamCode, killed, bossHurts, curRnd, timegap = 0, roundTime = 0 } = msg;
let teamStatus = getComTeamByCode(teamCode);
if (!teamStatus || !teamStatus.roleIds || teamStatus.roleIds.indexOf(roleId) === -1) {
checkTeamStatusAndSend(teamCode, roleId, sid);
@@ -473,7 +473,7 @@ export class ComBattleHandler {
if(!roleSt.startActionTime || roleSt.startActionTime == 0) { // 第一次调用设置初始
roleSt.startActionTime = nowSeconds();
}
if(timegap - (nowSeconds() - roleSt.startActionTime) > 5) { // 前后端误差超过5秒拦截
if ((roundTime > 0 && roundTime < 200) || (timegap - (nowSeconds() - roleSt.startActionTime) > 5)) { // 前后端误差超过5秒拦截
return resResult(STATUS.SUCCESS, {
isError: true,
timegap: nowSeconds() - roleSt.startActionTime