后台:修改服务器状态
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user