后台:添加服务器列表

This commit is contained in:
luying
2021-06-15 11:46:49 +08:00
parent 0be64c0244
commit 1d6a391874
6 changed files with 55 additions and 2 deletions

View File

@@ -14,6 +14,12 @@ export default class GameController extends Controller {
return
}
public async getServerList() {
const { ctx } = this;
ctx.body = await ctx.service.game.getServerList();
return
}
public async getDicHero() {
const { ctx } = this;
ctx.body = await ctx.service.game.getDicHero();

View File

@@ -45,6 +45,7 @@ export default (app: Application) => {
router.post('/api/game/getserverenv', tokenParser, controller.game.getServerEnv);
router.post('/api/game/getserverlistbyenv', tokenParser, controller.game.getServerListByEnv);
router.post('/api/game/getserverlist', controller.game.getServerList);
router.post('/api/game/getdicgoods', tokenParser, controller.game.getDicGoods);
router.post('/api/game/getdichero', tokenParser, controller.game.getDicHero);
router.post('/api/game/getdicrmb', tokenParser, controller.game.getDicRMB);

View File

@@ -38,6 +38,18 @@ export default class Game extends Service {
});
}
public async getServerList() {
const { ctx } = this;
const { page, pageSize, sortField, sortOrder, id, serverId, name, groupName, groupId, serverType } = ctx.request.body;
const list = await ServerlistModel.findByCondition(page, pageSize, sortField, sortOrder, id, serverId, name, groupName, groupId, serverType);
const total = await ServerlistModel.countByCondition( id, serverId, name, groupName, groupId, serverType)
return ctx.service.utils.resResult(STATUS.SUCCESS, {
list, total
});
}
public async getDicHero() {
let list: DicHero[] = [];
for(let [heroId, hero] of gameData.hero) {