服务器:修复白名单bug
This commit is contained in:
@@ -289,7 +289,6 @@ export default class Auth extends Service {
|
||||
public async checkRole(serverId: number) {
|
||||
const ctx = this.ctx;
|
||||
const { uid } = ctx;
|
||||
|
||||
let canLogin = await this.ctx.service.utils.validateCanLogin();
|
||||
if(!canLogin) return this.ctx.service.utils.resResult(STATUS.ONLINE_USER_MAX);
|
||||
|
||||
|
||||
@@ -65,14 +65,12 @@ export default class Utils extends Service {
|
||||
|
||||
// 检测是否可以登录
|
||||
public async validateCanLogin() {
|
||||
console.log('********* serverConst', gameData.serverConst)
|
||||
if(gameData.serverConst.CLOSE_LOGIN == 1) return false;
|
||||
if(gameData.serverConst.CLOSE_LOGIN_WHEN_ONLINE_MAX) {
|
||||
|
||||
let redisClient: RedisClient = this.ctx.app.context.redisClient;
|
||||
let count = await redisClient.hlenAsync(REDIS_KEY.ONLINE_USERS);
|
||||
|
||||
console.log('********* count', count)
|
||||
if(count >= gameData.serverConst.MAX_ONLINE_USER_COUNT) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user