后台:服务器维护

This commit is contained in:
luying
2021-12-08 10:25:21 +08:00
parent 103314a8bf
commit 22f8d3c438
29 changed files with 512 additions and 343 deletions
+20 -19
View File
@@ -1,6 +1,6 @@
import { Service } from 'egg';
import { STATUS } from '@consts';
import { GameModel } from '@db/Game';
// import { GameModel } from '@db/Game';
import { ServerlistModel } from '@db/Serverlist';
import { gameData } from '@pubUtils/data';
import { DicHero } from '@pubUtils/dictionary/DicHero';
@@ -21,27 +21,27 @@ export default class Game extends Service {
/**
* 获取正式服,测试服,开发服等环境
*/
public async getServerListByEnv() {
const { ctx, app } = this;
let env = app.config.env
let serverEnv = await GameModel.getServerEnvList();
let curEnv = serverEnv.find(cur => cur.env == env);
const list = await ServerlistModel.findByServerType(curEnv?.serverType);
// public async getServerListByEnv() {
// const { ctx, app } = this;
// let env = app.config.env
// let serverEnv = await GameModel.getServerEnvList();
// let curEnv = serverEnv.find(cur => cur.env == env);
// const list = await ServerlistModel.findByServerType(curEnv?.serverType);
return ctx.service.utils.resResult(STATUS.SUCCESS, {
list
});
}
// return ctx.service.utils.resResult(STATUS.SUCCESS, {
// list
// });
// }
public async getServerList(page: number, pageSize: number, sortField: string, sortOrder: string, form: { id?: number, serverId?: string|number, name?: string, groupName?: string, groupId?: number, serverType?: string } = {}) {
const { ctx } = this;
// public async getServerList(page: number, pageSize: number, sortField: string, sortOrder: string, form: { id?: number, serverId?: string|number, name?: string, groupName?: string, groupId?: number, serverType?: string } = {}) {
// const { ctx } = this;
const list = await ServerlistModel.findByCondition(page, pageSize, sortField, sortOrder, form);
const total = await ServerlistModel.countByCondition( form )
return ctx.service.utils.resResult(STATUS.SUCCESS, {
list, total
});
}
// const list = await ServerlistModel.findByCondition(page, pageSize, sortField, sortOrder, form);
// const total = await ServerlistModel.countByCondition( form )
// return ctx.service.utils.resResult(STATUS.SUCCESS, {
// list, total
// });
// }
public async getRegions() {
@@ -57,6 +57,7 @@ export default class Game extends Service {
const { ctx } = this;
const list = await ServerlistModel.getAllServerList();
console.log('******', list)
return ctx.service.utils.resResult(STATUS.SUCCESS, {
list
});