@ginstone/nga-api
Version:
47 lines (46 loc) • 1.82 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserInfoNuke = void 0;
const ObjUtils_1 = require("../../../utils/ObjUtils");
const Reputation_1 = require("../Reputation");
const UserMoreInfo_1 = require("./UserMoreInfo");
const BaseUserInfo_1 = require("./BaseUserInfo");
/**
* nuke.php接口返回的用户详细信息
*/
class UserInfoNuke extends BaseUserInfo_1.BaseUserInfo {
constructor(raw) {
super(raw);
this.admin = raw._admin === 1;
this.greaterAdmin = raw._greater === 1;
this.lesserAdmin = raw._lesser === 1;
this.superAdmin = raw._super === 1;
if (raw.adminForums)
this.adminForums = raw.adminForums;
this.bitData = raw.bit;
if (raw.email)
this.email = raw.email;
this.faction = raw.faction;
this.fame = raw.fame;
this.followCount = raw.follow;
this.followedCount = raw.follow_by_num;
this.gid = raw.gid;
this.groupName = raw.group;
this.ipLocation = raw.ipLoc;
this.items = raw.items;
if (raw.more_info) {
this.moreInfo = (0, ObjUtils_1.obj2List)(raw.more_info, (key, value) => new UserMoreInfo_1.UserMoreInfo(value.data, value.type));
const interactions = this.moreInfo.filter(i => i.type === 8)[0];
if (interactions)
this.interactions = interactions.data;
}
this.remark = raw.remark;
if (raw.userForum)
this.userForum = raw.userForum[1];
if (raw.reputation)
this.reputations = (0, ObjUtils_1.obj2List)(raw.reputation, (key, value) => new Reputation_1.Reputation(value));
if (raw.yz !== undefined)
this.accountStatus = raw.yz;
}
}
exports.UserInfoNuke = UserInfoNuke;