参数错误拦截

This commit is contained in:
luying
2021-01-21 18:12:45 +08:00
committed by liangtongchuan
parent 2d7106e599
commit da86ba4930
3 changed files with 8 additions and 2 deletions

View File

@@ -66,7 +66,7 @@ export class DailyBattleHandler {
// 购买每日次数
async buyNum(msg: { type: number, count: number }, session: BackendSession) {
let {type, count} = msg;
if(count < 0) return resResult(STATUS.WRONG_PARMS);
if( !count || count < 0) return resResult(STATUS.WRONG_PARMS);
const roleId = session.get('roleId');
const sid = session.get('sid');

View File

@@ -35,7 +35,7 @@ export class DungeonBattleHandler {
// 购买每日次数
async buyNum(msg: { count: number }, session: BackendSession) {
let { count } = msg;
if(count < 0) return resResult(STATUS.WRONG_PARMS);
if( !count || count < 0) return resResult(STATUS.WRONG_PARMS);
const roleId = session.get('roleId');
const sid = session.get('sid');

View File

@@ -168,5 +168,11 @@ module.exports = {
"battle.normalBattleHandler.checkBattle": {
"required uInt32 battleId": 1,
"repeated uInt32 heroes": 2
},
"battle.dungeonBattleHandler.buyNum": {
"required uInt32 count": 1
},
"battle.dailyBattleHandler.buyNum": {
"required uInt32 count": 1
}
}