军团:减少getGuildMember的返回数据
This commit is contained in:
@@ -9,7 +9,7 @@ import { ARMY } from '../../../pubUtils/dicParam';
|
|||||||
import { handleCost, addItems } from '../../../services/rewardService';
|
import { handleCost, addItems } from '../../../services/rewardService';
|
||||||
import { getGoldObject } from '../../../pubUtils/itemUtils';
|
import { getGoldObject } from '../../../pubUtils/itemUtils';
|
||||||
import { nowSeconds, getTimeFun, getSeconds } from '../../../pubUtils/timeUtil';
|
import { nowSeconds, getTimeFun, getSeconds } from '../../../pubUtils/timeUtil';
|
||||||
import { GuildListInfo } from '../../../domain/battleField/guild';
|
import { GuildListInfo, GuildMemberParam } from '../../../domain/battleField/guild';
|
||||||
import { GuildLeader } from '../../../domain/rank';
|
import { GuildLeader } from '../../../domain/rank';
|
||||||
import { UserGuildApplyModel } from '../../../db/UserGuildApply';
|
import { UserGuildApplyModel } from '../../../db/UserGuildApply';
|
||||||
import { hasStructureConsume, getStructureConsume, gameData } from '../../../pubUtils/data';
|
import { hasStructureConsume, getStructureConsume, gameData } from '../../../pubUtils/data';
|
||||||
@@ -520,19 +520,19 @@ export class GuildHandler {
|
|||||||
select.push('auth', 'activeWeekly activeUpdateTime');
|
select.push('auth', 'activeWeekly activeUpdateTime');
|
||||||
}
|
}
|
||||||
let list = await UserGuildModel.getListByGuild(code, select.join(' '), { auth: 1 });
|
let list = await UserGuildModel.getListByGuild(code, select.join(' '), { auth: 1 });
|
||||||
let result = [];
|
let result: GuildMemberParam[] = [];
|
||||||
for (let cur of list) {
|
for (let cur of list) {
|
||||||
let role = <RoleType>cur.role;
|
let role = <RoleType>cur.role;
|
||||||
if(role) {
|
if(role) {
|
||||||
delete role._id;
|
let param = new GuildMemberParam(cur, role);
|
||||||
delete cur.role;
|
let isOnline = await isRoleOnline(role.roleId);
|
||||||
let isOnline = await isRoleOnline(role.roleId)
|
param.setOnline(!!isOnline);
|
||||||
result.push({ ...cur, ...role, isOnline: !!isOnline });
|
result.push(param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result && result.length > 0) {
|
if (result && result.length > 0) {
|
||||||
let leader = result.shift();
|
let leader = result.shift(); // 团长在最上面
|
||||||
result.sort((a, b) => {
|
result.sort((a, b) => {
|
||||||
if (sort == 'active') {
|
if (sort == 'active') {
|
||||||
if (b.activeWeekly == a.activeWeekly) {
|
if (b.activeWeekly == a.activeWeekly) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { EXTERIOR } from "../../pubUtils/dicParam";
|
|||||||
import { HeroType } from "../../db/Hero";
|
import { HeroType } from "../../db/Hero";
|
||||||
import { PvpDefenseType } from "../../db/PvpDefense";
|
import { PvpDefenseType } from "../../db/PvpDefense";
|
||||||
import { PvpHistoryOppType } from "../../db/PvpHistoryOpp";
|
import { PvpHistoryOppType } from "../../db/PvpHistoryOpp";
|
||||||
|
import { UserGuildType } from "../../db/UserGuild";
|
||||||
|
|
||||||
export class PlayerDetailHero {
|
export class PlayerDetailHero {
|
||||||
actorId: number;
|
actorId: number;
|
||||||
@@ -185,3 +186,42 @@ export class GuildListInfo extends GuildMainInfo {
|
|||||||
this.hasApply = hasApply;
|
this.hasApply = hasApply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class GuildMemberParam {
|
||||||
|
roleId: string;
|
||||||
|
roleName: string;
|
||||||
|
ce: number;
|
||||||
|
head: number = EXTERIOR.EXTERIOR_FACE;
|
||||||
|
frame: number = EXTERIOR.EXTERIOR_FACECASE;
|
||||||
|
spine: number = EXTERIOR.EXTERIOR_APPEARANCE;
|
||||||
|
lv: number;
|
||||||
|
title: number = 1;
|
||||||
|
job: number;
|
||||||
|
quitTime: number;
|
||||||
|
isOnline: boolean;
|
||||||
|
|
||||||
|
auth?: number;
|
||||||
|
activeWeekly?: number;
|
||||||
|
activeUpdateTime?: number;
|
||||||
|
|
||||||
|
constructor(userGuild: UserGuildType, role: RoleType) {
|
||||||
|
this.roleId = role.roleId;
|
||||||
|
this.roleName = role.roleName;
|
||||||
|
this.ce = role.ce;
|
||||||
|
this.head = role.head;
|
||||||
|
this.frame = role.frame;
|
||||||
|
this.spine = role.spine;
|
||||||
|
this.lv = role.lv;
|
||||||
|
this.title = role.title;
|
||||||
|
this.quitTime = role.quitTime;
|
||||||
|
|
||||||
|
this.job = userGuild.job;
|
||||||
|
this.auth = userGuild.auth;
|
||||||
|
this.activeWeekly = userGuild.activeWeekly;
|
||||||
|
this.activeUpdateTime = userGuild.activeUpdateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
setOnline(isOnline: boolean) {
|
||||||
|
this.isOnline = isOnline;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user