后台:运营活动后台

This commit is contained in:
luying
2021-05-19 16:24:52 +08:00
parent 0c39b9ebb7
commit 91af65259c
14 changed files with 178 additions and 6 deletions
+19 -1
View File
@@ -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
});
}
}