登录:多地登陆拦截
This commit is contained in:
@@ -55,12 +55,8 @@ export class EntryHandler {
|
||||
|
||||
let connect = await getRoleOnlineInfo(role.roleId);
|
||||
|
||||
if (connect.isOnline) { // 多地登陆踢下线
|
||||
if (connect.sid = self.app.getServerId()) {
|
||||
await kickUser(self.app, role.roleId);
|
||||
} else {
|
||||
await self.app.rpc.connector.connectorRemote.remoteLogin.toServer(connect.sid, role.roleId);
|
||||
}
|
||||
if (connect.isOnline) { // 多地登陆拦截
|
||||
return resResult(STATUS.LOGIN_DUPLICATE);
|
||||
}
|
||||
let serverName = this.app.getServerId();
|
||||
await roleLogin(role.roleId, user.userCode, serverName, user.pkgName, role.createTime, role.serverId); // 保存在线用户
|
||||
|
||||
@@ -15,6 +15,7 @@ export const STATUS = {
|
||||
ACCESS_BUSY: { code: 12, simStr: '您不久前发送过消息了,请稍等一下' },
|
||||
ONLINE_USER_MAX: { code: 13, simStr: '服务器繁忙,请稍后再试' },
|
||||
FUNCTION_CLOSE: { code: 14, simStr: '抱歉,该功能暂时关闭' },
|
||||
LOGIN_DUPLICATE: { code: 15, simStr: '您的账号在其他设备上已登录' },
|
||||
GLOBAL_ERR: { code: 1003, simStr: '服务器内部错误' },
|
||||
UPDATE_INFO_ERR: {code: 1004, simStr: '热更新配置错误'},
|
||||
// http请求
|
||||
|
||||
Reference in New Issue
Block a user