web-server 注册、登录、获取服务器列表;game-server token 校验
This commit is contained in:
17
web-server/app/controller/game.ts
Normal file
17
web-server/app/controller/game.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { SERVER_NOT_FOUND } from './../../../shared/statusCode';
|
||||
import { STATUS_SUC } from '../../../shared/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;
|
||||
let serverList: Array<any> = await GameModel.getServerListByType(serverType);
|
||||
if (serverList && serverList.length > 0) {
|
||||
ctx.body = {status: STATUS_SUC.code, data: { serverList }};
|
||||
} else {
|
||||
ctx.body = ctx.service.utils.exceptionResult(SERVER_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user