后台:可以设置固定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

@@ -334,15 +334,18 @@ export default class Role extends BaseModel {
@prop({ required: false })
ipLocation: string;
@prop({ required: false })
fixedIpLocation: string;
public static async findAllByUid(uid: number, getters = false, virtuals = true) {
const role: RoleType[] = await RoleModel.find({ 'userInfo.uid': uid }).select('roleId roleName serverId head frame spine heads frames spines lv updatedAt').lean({ getters, virtuals });
return role;
}
public static async findByUidAndSetTime(uid: number, serverId: number, select?: string, getters = false) {
public static async findByUidAndSetTime(uid: number, serverId: number, ip: string, ipLocation: string, select?: string, getters = false) {
const curSec = nowSeconds();
// 为了计算累计登录此处查询new为false
const role: RoleType = await RoleModel.findOneAndUpdate({ 'userInfo.uid': uid, serverId }, { loginTime: curSec, quitTime: curSec }, { new: false }).select(select).lean({ getters, virtuals: true });
const role: RoleType = await RoleModel.findOneAndUpdate({ 'userInfo.uid': uid, serverId }, { $set: { loginTime: curSec, quitTime: curSec, ip, ipLocation } }, { new: false }).select(select).lean({ getters, virtuals: true });
return role;
}

View File

@@ -127,7 +127,7 @@ export class PlayerDetail {
if(role.head) this.head = role.head;
if(role.frame) this.frame = role.frame;
if(role.spine) this.spine = role.spine;
if(role.ipLocation) this.ipLocation = role.ipLocation;
this.ipLocation = role.fixedIpLocation||role.ipLocation||'未知';
}
setCe(ce: number) {

View File

@@ -30,7 +30,7 @@ export class FriendParams {
this.ce = role.ce;
this.title = role.title;
this.guildName = role.guildName||'';
this.ipLocation = role.ipLocation||'';
this.ipLocation = role.fixedIpLocation||role.ipLocation||'未知';
}
setServerName(serverId: number, serverName: string) {