后台:可以设置固定ip属地

This commit is contained in:
luying
2022-08-04 19:33:36 +08:00
parent 0d1eb9c7b6
commit 0449983cd1
8 changed files with 22 additions and 18 deletions

View File

@@ -21,7 +21,7 @@ import { getExpByLv } from '../../../pubUtils/data';
import { reportCreateRoleEventToTa, reportTAEvent, reportTAUserSet } from '../../../services/sdkService';
import { saveLoginAndOutLog } from '../../../pubUtils/logUtil';
import { sendMessageToAllWithSuc } from '../../../services/pushService';
import { setIpLocation } from '../../../services/roleService';
import { getIpLocation } from '../../../services/roleService';
export default function (app: Application) {
new HandlerService(app, {});
@@ -59,18 +59,18 @@ export class EntryHandler {
}
}
let role = await RoleModel.findByUidAndSetTime(user.uid, serverId, null, true);
let ip = this.getIp(session);
let ipLocation = await getIpLocation(ip);
let role = await RoleModel.findByUidAndSetTime(user.uid, serverId, ip, ipLocation, null, true);
if (!role) {
return resResult(STATUS.ROLE_NOT_FOUND);
}
setIpLocation(role.roleId, this.getIp(session));
let serverName = this.app.getServerId();
await roleLogin(role.roleId, user.userCode, serverName, role.createTime, role.serverId, role.lv, role.topLineupCe); // 保存在线用户
await this.addSession(user, role, session);
await reportCreateRoleEventToTa(role, this.getIp(session));
await reportCreateRoleEventToTa(role, ip);
saveLoginAndOutLog(LOG_TYPE.LOGIN, session);
addRoleToSysChannel(role.roleId, self.app.get('serverId'), role.serverId);
addRoleToWorldChannel(role.roleId, self.app.get('serverId'), role.serverId);