后台:可以设置固定ip属地
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user