后台:修改服务器状态

This commit is contained in:
luying
2021-12-08 11:58:56 +08:00
parent aec83c1481
commit b51a2839da
9 changed files with 52 additions and 14 deletions

View File

@@ -19,6 +19,10 @@ export default class FooBoot implements IBoot {
await this.connectGMDB(this.app);
await this.connectRedis(this.app);
this.app.config.realEnv = this.app.config.env;
if(this.app.config.env == 'local') {
this.app.config.realEnv = 'development';
}
}
configDidLoad() {

View File

@@ -31,6 +31,7 @@ export default class GameController extends Controller {
let serverList = new Array<GroupParam>();
let loginServerList = new Array<ServerParamWithRole>();
console.log('****', ctx.app.config.realEnv)
let allServers = await ServerlistModel.findByEnv(ctx.app.config.realEnv);
let roles = await RoleModel.findAllByUid(uid, true, true);
for (let server of allServers) {
@@ -50,7 +51,7 @@ export default class GameController extends Controller {
loginServerList.sort((a, b) => { return b.updatedAt.getTime() - a.updatedAt.getTime() });
if (serverList && serverList.length > 0) {
if (serverList) {
ctx.body = ctx.service.utils.resResult(STATUS.SUCCESS, { serverList, loginServerList });
} else {
ctx.body = ctx.service.utils.resResult(STATUS.SERVER_NOT_FOUND);

View File

@@ -291,10 +291,10 @@ export default class Auth extends Service {
const ctx = this.ctx;
const { uid } = ctx;
const role = await RoleModel.findByUid(uid, serverId);
if(role.blockType == BLOCK_TYPE.BLOCK) {
return ctx.service.utils.resResult(STATUS.BLOCKED);
}
if (role) {
if(role.blockType == BLOCK_TYPE.BLOCK) {
return ctx.service.utils.resResult(STATUS.BLOCKED);
}
return ctx.service.utils.resResult(STATUS.SUCCESS, { roleId: role.roleId });
}
return ctx.service.utils.resResult(STATUS.ROLE_NOT_FOUND);