UNPKG

@ginstone/nga-api

Version:

54 lines (53 loc) 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ForumSubGroup = exports.ForumGroup = exports.ForumEntry = void 0; const ObjUtils_1 = require("../utils/ObjUtils"); const StrUtils_1 = require("../utils/StrUtils"); /** * 版面入口 */ class ForumEntry { constructor(raw) { if (raw.fid) this.forumId = raw.fid; if (raw.name) this.name = raw.name; if (raw.nameS) this.simpleName = raw.nameS; if (raw.info) this.info = raw.info; if (raw.infoS) this.simpleInfo = raw.infoS; if (raw.infoL) this.longInfo = raw.infoL; if (raw.bit) this.bit = raw.bit; if (raw.stid) this.colTid = raw.stid; this.icon = (0, StrUtils_1.getIcon)(raw.stid, raw.fid, raw.stid); this.iconBig = (0, StrUtils_1.getBigIcon)(raw.stid || raw.fid); } } exports.ForumEntry = ForumEntry; /** * 版面分组 */ class ForumGroup { constructor(raw) { this.id = raw.id; this.name = raw.name; this.subGroups = (0, ObjUtils_1.values)(raw.content).map(r => new ForumSubGroup(r)).filter(r => r.forums.length > 0); } } exports.ForumGroup = ForumGroup; /** * 版面子组 */ class ForumSubGroup { constructor(raw) { if (raw.name) this.name = raw.name; this.forums = (0, ObjUtils_1.values)(raw.content).map(r => new ForumEntry(r)); } } exports.ForumSubGroup = ForumSubGroup;