系统:停服维护逻辑

This commit is contained in:
luying
2021-07-15 14:31:29 +08:00
parent 352aecfb56
commit 0028c9b992
26 changed files with 348 additions and 50 deletions

View File

@@ -0,0 +1,22 @@
import { STATUS } from '@consts';
import { checkWhiteList } from 'app/pubUtils/util';
module.exports = () => {
return async function checkMainten(ctx, next) {
const { serverId } = ctx.request.body;
if (serverId) {
let maintenServers = ctx.service.game.getServerMainten();
if (maintenServers.indexOf(serverId) != -1) {
let isWhiteList = await checkWhiteList(ctx.tel, ctx.request.ip, ctx.auth);
if (isWhiteList) {
await next();
} else {
ctx.body = ctx.service.utils.resResult(STATUS.SERVER_MAINTENANCE);
return;
}
}
}
await next();
};
};

View File

@@ -19,6 +19,7 @@ module.exports = () => {
ctx.auth = user.auth;
ctx.userCode = user.userCode;
ctx.pkgName = user.pkgName;
ctx.tel = user.tel;
await next();
};
};