pvp: 保存人数限制
This commit is contained in:
@@ -10,7 +10,7 @@ import { PvpDefenseModel, OppPlayers } from '../../../db/PvpDefense';
|
||||
import { pvpEndParamInter } from '../../../pubUtils/interface';
|
||||
import { RankParam } from '../../../domain/rank';
|
||||
import { PlayerDetail, PlayerDetailHero } from '../../../domain/battleField/guild';
|
||||
import { PVP_HERO_POS, REDIS_KEY } from '../../../consts';
|
||||
import { PVP_HERO_POS, REDIS_KEY, LINEUP_NUM } from '../../../consts';
|
||||
import { PVP } from '../../../pubUtils/dicParam';
|
||||
import { addItems } from '../../../services/rewardService';
|
||||
import { HeroModel } from '../../../db/Hero';
|
||||
@@ -304,7 +304,7 @@ export class PvpHandler {
|
||||
async saveDefense(msg: { heroes: Array<{actorId: number, dataId: number, order: number}>, isDefaultHero:boolean }, session: BackendSession) {
|
||||
let {heroes, isDefaultHero} = msg;
|
||||
let roleId = session.get('roleId');
|
||||
if (heroes.length > 5 || heroes.length <= 0) {
|
||||
if (heroes.length > LINEUP_NUM || heroes.length <= 0) {
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
heroes = uniq(heroes, function(item) {
|
||||
@@ -335,7 +335,7 @@ export class PvpHandler {
|
||||
defHeros[defIndex].dataId = dataId;
|
||||
continue;
|
||||
}
|
||||
if (heroes[index].order < 1 || heroes[index].order > 5) {
|
||||
if (heroes[index].order < 1 || heroes[index].order > LINEUP_NUM) {
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
let hero = await HeroModel.findByHidAndRole(heroes[index].actorId, roleId);
|
||||
|
||||
Reference in New Issue
Block a user