关卡:修改关卡列表接口
This commit is contained in:
@@ -12,7 +12,7 @@ import { STATUS } from '../../../consts/statusCode';
|
|||||||
import { resResult } from '../../../pubUtils/util';
|
import { resResult } from '../../../pubUtils/util';
|
||||||
import { RoleModel } from '../../../db/Role';
|
import { RoleModel } from '../../../db/Role';
|
||||||
import { RScriptRecordModel } from '../../../db/RScriptRecord';
|
import { RScriptRecordModel } from '../../../db/RScriptRecord';
|
||||||
import { checkBattleHeroes, roleLevelup, getBattleList, calculateWarStar } from '../../../services/normalBattleService';
|
import { checkBattleHeroes, roleLevelup, getBattleList, calculateWarStar, getBattleListOfTypes } from '../../../services/normalBattleService';
|
||||||
import { checkDungeonNum, checkDungeonAndIncrease, saveDungeonFirst } from '../../../services/dungeonService';
|
import { checkDungeonNum, checkDungeonAndIncrease, saveDungeonFirst } from '../../../services/dungeonService';
|
||||||
// import { switchOnFunc } from '../../../services/funcSwitchService';
|
// import { switchOnFunc } from '../../../services/funcSwitchService';
|
||||||
import { gameData } from '../../../pubUtils/data';
|
import { gameData } from '../../../pubUtils/data';
|
||||||
@@ -113,14 +113,14 @@ export class NormalBattleHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 关卡列表
|
// 关卡列表
|
||||||
async getBattleList(msg: { type: number }, session: BackendSession) {
|
async getBattleList(msg: { types: number[] }, session: BackendSession) {
|
||||||
const { type } = msg;
|
const { types } = msg;
|
||||||
let roleId = session.get('roleId');
|
let roleId = session.get('roleId');
|
||||||
|
|
||||||
let role = await RoleModel.findByRoleId(roleId);
|
let role = await RoleModel.findByRoleId(roleId);
|
||||||
let result = await getBattleList(role, type);
|
let result = await getBattleListOfTypes(role, types);
|
||||||
return resResult(STATUS.SUCCESS, {
|
return resResult(STATUS.SUCCESS, {
|
||||||
list: result
|
result
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,10 @@ export function calculateWarStar(warStar: WarStar[] = [], battleId: number, star
|
|||||||
|
|
||||||
export async function getBattleListOfMain(role: RoleType) {
|
export async function getBattleListOfMain(role: RoleType) {
|
||||||
let types = [ WAR_TYPE.NORMAL, WAR_TYPE.VESTIGE, WAR_TYPE.MAIN_ELITE, WAR_TYPE.TOWER, WAR_TYPE.MYSTERY, WAR_TYPE.MYSTERY_ELITE ];
|
let types = [ WAR_TYPE.NORMAL, WAR_TYPE.VESTIGE, WAR_TYPE.MAIN_ELITE, WAR_TYPE.TOWER, WAR_TYPE.MYSTERY, WAR_TYPE.MYSTERY_ELITE ];
|
||||||
|
return await getBattleListOfTypes(role, types);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getBattleListOfTypes(role: RoleType, types: number[]) {
|
||||||
let result = [];
|
let result = [];
|
||||||
for(let type of types) {
|
for(let type of types) {
|
||||||
let list = await getBattleList(role, type);
|
let list = await getBattleList(role, type);
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ module.exports = {
|
|||||||
// "required string roleName": 1
|
// "required string roleName": 1
|
||||||
// },
|
// },
|
||||||
"battle.normalBattleHandler.getBattleList": {
|
"battle.normalBattleHandler.getBattleList": {
|
||||||
"required uInt32 type": 1
|
"repeated uInt32 types": 1
|
||||||
},
|
},
|
||||||
"battle.normalBattleHandler.checkBattle": {
|
"battle.normalBattleHandler.checkBattle": {
|
||||||
"required uInt32 battleId": 1,
|
"required uInt32 battleId": 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user