🐞 fix(37需求): 账号多开

This commit is contained in:
luying
2023-05-25 16:33:40 +08:00
parent 0b2dbabfd8
commit 42c9397349
2 changed files with 12 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ import { REDIS_KEY, SERVER_STATUS } from '@consts';
import { getRedisSubChannel } from 'app/pubUtils/sdkUtil';
import { ServerlistType } from '@db/Serverlist';
import { nowSeconds } from 'app/pubUtils/timeUtil';
import { checkWhiteList } from 'app/pubUtils/sysUtil';
const csprng = require('csprng');
/**
* Utils Service
@@ -63,8 +64,9 @@ export default class Utils extends Service {
public async checkOnlineUser(userCode: string) {
let redisClient: RedisClient = this.ctx.app.context.redisClient;
let onlineRoleId = await redisClient.hgetAsync(REDIS_KEY.USER_CODE, userCode);
let isWhiteList = await checkWhiteList(this.ctx.app.config.realEnv, this.ctx.clientIp, this.ctx.uid);
if (!!onlineRoleId) { // 多地登陆踢下线
if (!isWhiteList && !!onlineRoleId) { // 多地登陆踢下线
let str = await redisClient.hgetAsync(REDIS_KEY.ONLINE_USERS, onlineRoleId);
if(str) {