排行榜:加入军团后军团名显示

This commit is contained in:
luying
2022-08-30 14:43:22 +08:00
parent c193345679
commit 1363e0c1fa
3 changed files with 22 additions and 13 deletions
+16 -13
View File
@@ -5,7 +5,7 @@ import { HeroUpdate, } from "../db/Hero";
import { getSeconds } from "../pubUtils/timeUtil";
import { prop } from "@typegoose/typegoose";
import { pick } from "underscore";
import { REDIS_KEY } from "../consts";
import { RANK_TYPE, REDIS_KEY } from "../consts";
// 排行榜返回玩家值
export class RankParam {
@@ -390,26 +390,29 @@ export class GeneralRankParam {
type: number; // 排行榜id
hasUser: boolean = false;
userInfo?: RankParam;
num: number;
num: number = 0;
received: number[];
constructor(type: number, rankInfo: RoleRankInfo|GuildRankInfo, general: number, received?: number[]) {
this.type = type;
if(general == 1) {
if(rankInfo instanceof RoleRankInfo) {
this.userInfo = pick(rankInfo, ['roleId', 'roleName', 'head', 'frame', 'spine', 'guildName', 'ce', 'title', 'lv', 'topLineupCe']);
this.hasUser = true;
}
if(rankInfo instanceof GuildRankInfo) {
let leaderInfo = pick(rankInfo.leader, ['roleId', 'roleName', 'head', 'frame', 'spine', 'ce', 'title', 'lv']);
this.userInfo = {
...leaderInfo, guildName: rankInfo.name, ce: rankInfo.guildCe, topLineupCe: rankInfo.guildCe
let rank = rankInfo? (type == RANK_TYPE.LADDER? rankInfo.num: rankInfo.rank): 0;
if(rank == 1) {
if(rankInfo instanceof RoleRankInfo) {
this.userInfo = pick(rankInfo, ['roleId', 'roleName', 'head', 'frame', 'spine', 'guildName', 'ce', 'title', 'lv', 'topLineupCe']);
this.hasUser = true;
}
this.hasUser = true;
if(rankInfo instanceof GuildRankInfo) {
let leaderInfo = pick(rankInfo.leader, ['roleId', 'roleName', 'head', 'frame', 'spine', 'ce', 'title', 'lv']);
this.userInfo = {
...leaderInfo, guildName: rankInfo.name, ce: rankInfo.guildCe, topLineupCe: rankInfo.guildCe
}
this.hasUser = true;
}
this.num = rankInfo?.num||0;
}
}
this.num = rankInfo?.num||0;
this.received = received;
}
}