Files
ZYZ/web-server/app/controller/game.ts

17 lines
584 B
TypeScript

import { STATUS } from '@consts/statusCode';
import { GameModel } from '@db/Game';
import { Controller } from 'egg';
export default class GameController extends Controller {
public async getServerList() {
const { ctx } = this;
const { serverType } = ctx.request.body;
const serverList: Array<any> = await GameModel.getServerListByType(serverType);
if (serverList && serverList.length > 0) {
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { serverList });
} else {
ctx.body = ctx.service.utils.resResult(STATUS.SERVER_NOT_FOUND);
}
}
}