后台:运营活动后台
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Service } from 'egg';
|
||||
import { STATUS } from '@consts';
|
||||
import { GameModel } from '@db/Game';
|
||||
import { ServerlistModel } from '@db/Serverlist';
|
||||
|
||||
/**
|
||||
* Test Service
|
||||
@@ -8,7 +9,7 @@ import { GameModel } from '@db/Game';
|
||||
export default class Game extends Service {
|
||||
|
||||
/**
|
||||
* 后台账号登录
|
||||
* 获取正式服,测试服,开发服等环境
|
||||
*/
|
||||
public async getServerEnv() {
|
||||
const { ctx, app } = this;
|
||||
@@ -19,4 +20,21 @@ export default class Game extends Service {
|
||||
env: app.config.env
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取正式服,测试服,开发服等环境
|
||||
*/
|
||||
public async getServerListByEnv() {
|
||||
const { ctx, app } = this;
|
||||
const envlist = await GameModel.getServerEnvList();
|
||||
let cur = envlist.find(cur => cur.env == app.config.env);
|
||||
if(!cur) return ctx.service.utils.resResult(STATUS.SUCCESS, { list: [] });
|
||||
|
||||
const list = await ServerlistModel.findByServerType(cur.serverType);
|
||||
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
list
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user