排行榜:修改格式
This commit is contained in:
@@ -14,7 +14,7 @@ export enum ROLE_SELECT {
|
||||
COM_BATTLE = 'lv head frame spine topLineupCe',
|
||||
GET_HEADS = 'heads head frames frame spines spine',
|
||||
// 排行榜基础数据
|
||||
RANK = 'roleId roleName lv vLv head frame spine title guildName ce isReducedCe topLineup towerLv towerUpTime topLineupCe heroNum updatedAt heroNumUpdatedAt dungeonWarId dungeonUpdatedAt dungeonHeroes mainWarId mainUpdatedAt mainEliteWarId mainEliteUpdatedAt showLineup',
|
||||
RANK = 'roleId roleName lv vLv head frame spine title guildName ce isReducedCe topLineup towerLv towerUpTime topLineupCe heroNum updatedAt heroNumUpdatedAt dungeonWarId dungeonUpdatedAt dungeonHeroes mainWarId mainUpdatedAt mainEliteWarId mainEliteUpdatedAt showLineup hasGuild',
|
||||
};
|
||||
|
||||
export enum HERO_SELECT {
|
||||
@@ -42,7 +42,7 @@ export enum GUILD_SELECT {
|
||||
// 获得邀请列表
|
||||
INVITED_MEMBER = '_id code isMemberMax +invitedMembers +inviteTime',
|
||||
// 排行榜字段
|
||||
RANK = 'code name icon lv memberCnt leader lvUpdateTime activeWeekly activeUpdateTime'
|
||||
RANK = 'code name icon lv memberCnt leader lvUpdateTime activeWeekly activeUpdateTime guildCe'
|
||||
}
|
||||
|
||||
export enum FRIEND_SHIP_SELECT {
|
||||
|
||||
@@ -199,37 +199,37 @@ export const DEFAULT_HERO_LV = 1;
|
||||
|
||||
export const FIX_SMS_CODE_TELS = ['18855953630', '13911134885', '15167549151', '15618654010', '15167549151', '18342915387', '15000250967'];
|
||||
|
||||
export const REDIS_KEY = {
|
||||
USER_INFO: "userInfo", // 玩家缓存信息
|
||||
TOWER_RANK: "towerRank", // 天梯排行榜
|
||||
COM_TEAM_SEARCH_PRE: 'comTeamSerQ', // 匹配中的玩家,按品质分
|
||||
PVP_RANK: "pvpRank", // pvp排行榜
|
||||
GUILD_INFO: "guildInfo", // 公会信息
|
||||
GUILD_ACTIVE_RANK: "guildActiveRank", // 公会周活跃排行榜
|
||||
DB_GAME: 'dbGame', // 服务器列表
|
||||
ONLINE_USERS: 'onlineUsers', // 在线用户情况
|
||||
ONLINE_TIME: 'onlineTime', // 玩家在线时间
|
||||
CHANNEL_SERVERS: 'chat:channelServers', // 渠道对应的 chat 服务器 Id,
|
||||
USER_GATE_ACTIVITY: 'usrGateAct', // 蛮夷入侵玩家排行
|
||||
GATE_ACTIVITY: 'gateAct', // 蛮夷入侵军团排行
|
||||
USER_CITY_ACTIVITY: 'usrCityAct', // 诸侯混战玩家排行
|
||||
CITY_ACTIVITY: 'cityAct', // 诸侯混战军团排行
|
||||
RACE_ACTIVITY: 'raceAct', // 粮草先行军团排行
|
||||
TOP_LINEUP_INFO: 'topLineInfo', // 最强阵容数据
|
||||
TOP_LINEUP_RANK: 'topLineRank', // 最强阵容排行
|
||||
TOP_HERO_RANK: 'topHeroRank', // 最强武将排行
|
||||
HERO_INFO: 'heroInfo', // 最强武将信息
|
||||
HERO_NUM_RANK: 'heroNum', // 武将数量排行
|
||||
USER_LV: 'usrLv', // 主公等级排行榜
|
||||
SUM_CE_RANK: 'sumCeRank', // 总战力排名
|
||||
DUNGEON_RANK: 'dungeonRank', // 秘境排名
|
||||
DUNGEON_LINEUP: 'dungeonLineup', // 秘境通关阵容
|
||||
MAIN_RANK: 'mainRank', // 主线通关排名
|
||||
MAIN_ELITE_RANK: 'mainEliteRank', // 精英通关排名
|
||||
GUILD_LV_RANK: "guildLvRank", // 公会等级排行榜
|
||||
HERO_RANK: "heroRank", // 武将排行榜
|
||||
SHOW_LINEUP: "showLineup", // 展示阵容
|
||||
SYS_SERVER: 'sysServer', // 全服connector服
|
||||
export enum REDIS_KEY {
|
||||
USER_INFO ="userInfo", // 玩家缓存信息
|
||||
TOWER_RANK ="towerRank", // 天梯排行榜
|
||||
COM_TEAM_SEARCH_PRE ='comTeamSerQ', // 匹配中的玩家,按品质分
|
||||
PVP_RANK ="pvpRank", // pvp排行榜
|
||||
GUILD_INFO ="guildInfo", // 公会信息
|
||||
GUILD_ACTIVE_RANK ="guildActiveRank", // 公会周活跃排行榜
|
||||
DB_GAME ='dbGame', // 服务器列表
|
||||
ONLINE_USERS ='onlineUsers', // 在线用户情况
|
||||
ONLINE_TIME ='onlineTime', // 玩家在线时间
|
||||
CHANNEL_SERVERS ='chat:channelServers', // 渠道对应的 chat 服务器 Id,
|
||||
USER_GATE_ACTIVITY ='usrGateAct', // 蛮夷入侵玩家排行
|
||||
GATE_ACTIVITY ='gateAct', // 蛮夷入侵军团排行
|
||||
USER_CITY_ACTIVITY ='usrCityAct', // 诸侯混战玩家排行
|
||||
CITY_ACTIVITY ='cityAct', // 诸侯混战军团排行
|
||||
RACE_ACTIVITY ='raceAct', // 粮草先行军团排行
|
||||
TOP_LINEUP_INFO ='topLineInfo', // 最强阵容数据
|
||||
TOP_LINEUP_RANK ='topLineRank', // 最强阵容排行
|
||||
TOP_HERO_RANK ='topHeroRank', // 最强武将排行
|
||||
HERO_INFO ='heroInfo', // 最强武将信息
|
||||
HERO_NUM_RANK ='heroNum', // 武将数量排行
|
||||
USER_LV ='usrLv', // 主公等级排行榜
|
||||
SUM_CE_RANK ='sumCeRank', // 总战力排名
|
||||
DUNGEON_RANK ='dungeonRank', // 秘境排名
|
||||
DUNGEON_LINEUP ='dungeonLineup', // 秘境通关阵容
|
||||
MAIN_RANK ='mainRank', // 主线通关排名
|
||||
MAIN_ELITE_RANK ='mainEliteRank', // 精英通关排名
|
||||
GUILD_LV_RANK ="guildLvRank", // 公会等级排行榜
|
||||
HERO_RANK ="heroRank", // 武将排行榜
|
||||
SHOW_LINEUP ="showLineup", // 展示阵容
|
||||
SYS_SERVER ='sysServer', // 全服connector服
|
||||
}
|
||||
|
||||
// 各排行榜对应hash的key
|
||||
|
||||
+74
-55
@@ -6,6 +6,7 @@ import { GuildUpdateParam } from "../db/Guild";
|
||||
import { HeroType, HeroUpdate } from "../db/Hero";
|
||||
import { getSeconds } from "../pubUtils/timeUtil";
|
||||
import { prop } from "@typegoose/typegoose";
|
||||
import { pick } from "underscore";
|
||||
|
||||
// 排行榜返回玩家值
|
||||
export class RankParam {
|
||||
@@ -16,7 +17,7 @@ export class RankParam {
|
||||
lv: number = 0;
|
||||
|
||||
@prop({ required: true })
|
||||
vLv: number = 0;
|
||||
vLv?: number = 0;
|
||||
|
||||
@prop({ required: true })
|
||||
guildName: string = "";
|
||||
@@ -37,7 +38,7 @@ export class RankParam {
|
||||
ce: number = 0;
|
||||
|
||||
@prop({ required: true })
|
||||
updatedAt: number = 0;
|
||||
updatedAt?: number = 0;
|
||||
|
||||
constructor(role: RoleUpdate|RankParam, fromDb: boolean) {
|
||||
if(role.roleName) this.roleName = role.roleName;
|
||||
@@ -93,6 +94,8 @@ export class RoleRankInfo extends RankParam {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 公会排行榜返回值
|
||||
export class GuildRankParam {
|
||||
icon: number;
|
||||
@@ -107,8 +110,8 @@ export class GuildRankParam {
|
||||
head: number;
|
||||
frame: number;
|
||||
spine: number;
|
||||
|
||||
}
|
||||
};
|
||||
guildCe: number;
|
||||
|
||||
constructor(guild: GuildUpdateParam) {
|
||||
this.icon = guild.icon;
|
||||
@@ -117,6 +120,7 @@ export class GuildRankParam {
|
||||
let leader = <RoleType>guild.leader;
|
||||
let _leader = new GuildLeader(leader);
|
||||
this.leader = _leader;
|
||||
this.guildCe = guild.guildCe;
|
||||
this.memberCnt = guild.memberCnt;
|
||||
}
|
||||
}
|
||||
@@ -126,6 +130,7 @@ export class GuildRankInfo extends GuildRankParam {
|
||||
code: string;
|
||||
num: number;
|
||||
time: number;
|
||||
active?: number;
|
||||
|
||||
setInfo(rank: number, myId: myIdInter, num: number, time: number) {
|
||||
this.rank = rank;
|
||||
@@ -134,11 +139,53 @@ export class GuildRankInfo extends GuildRankParam {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
setInfo2(rank: number, myId: myIdInter, num: number, active: number, time: number) {
|
||||
this.rank = rank;
|
||||
this.code = myId.guildCode;
|
||||
this.num = num;
|
||||
this.time = time;
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
isMyInfo(myId: myIdInter) {
|
||||
return this.code == myId.guildCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class RoleAndGuildRankInfo {
|
||||
rank: number;
|
||||
num: number;
|
||||
userInfo?: RankParam & { roleId: string };
|
||||
lineup?: LineupParam[];
|
||||
guildInfo?: GuildRankParam & { code: string };
|
||||
|
||||
constructor(rank: number, num: number) {
|
||||
this.rank = rank;
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
setUserInfo(role: RoleRankInfo) {
|
||||
this.userInfo = pick(role, ['roleId', 'roleName', 'head', 'frame', 'spine', 'lv', 'title', 'guildName', 'ce']);
|
||||
this.lineup = role.lineup;
|
||||
}
|
||||
|
||||
setGuildInfo(guild: GuildRankInfo) {
|
||||
this.guildInfo = pick(guild, ['code', 'icon', 'name', 'leader', 'guildCe', 'lv', 'memberCnt', 'active']);
|
||||
}
|
||||
|
||||
isMyInfo(myId: myIdInter) {
|
||||
if(this.userInfo && myId.roleId) {
|
||||
if(this.userInfo.roleId == myId.roleId) return true;
|
||||
}
|
||||
if(this.guildInfo && myId.guildCode) {
|
||||
if(this.guildInfo.code == myId.guildCode) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class GuildLeader {
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
@@ -275,6 +322,26 @@ export class KeyName {
|
||||
|
||||
export type KeyNameParam = Partial<KeyName>;
|
||||
|
||||
export class ValueConfig {
|
||||
isMain: boolean; // 最主要的排序,getRank的num字段,isInc的时候只有这个会用zinc
|
||||
name: string
|
||||
len: number; // 长度
|
||||
weight?: number; // 按顺序排之后,其他参数的len加和
|
||||
reverse: boolean = false; // 例如时间戳,需要倒转的那种
|
||||
isTimestamp: boolean = false; // 是否是时间戳
|
||||
|
||||
constructor(isMain: boolean, name: string, len: number, reverse = false, isTimestamp = false) {
|
||||
this.isMain = isMain;
|
||||
this.name = name;
|
||||
this.len = len;
|
||||
this.reverse = reverse;
|
||||
this.isTimestamp = isTimestamp;
|
||||
}
|
||||
|
||||
setWeight(weight: number) {
|
||||
this.weight = weight;
|
||||
}
|
||||
}
|
||||
|
||||
export interface myIdInter {
|
||||
roleId?: string;
|
||||
@@ -283,64 +350,16 @@ export interface myIdInter {
|
||||
}
|
||||
|
||||
// 排行榜总览左边的数据
|
||||
export class GeneralRankParamRole {
|
||||
export class GeneralRankParam {
|
||||
type: number; // 排行榜id
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
head: number;
|
||||
frame: number;
|
||||
spine: number;
|
||||
lv: number;
|
||||
vLv: number;
|
||||
guildName: string;
|
||||
ce: number;
|
||||
userInfo: RankParam;
|
||||
num: number;
|
||||
received: number[];
|
||||
|
||||
constructor(type: number, rankInfo: RoleRankInfo, received?: number[]) {
|
||||
this.type = type;
|
||||
this.roleId = rankInfo.roleId;
|
||||
this.roleName = rankInfo.roleName;
|
||||
this.head = rankInfo.head;
|
||||
this.frame = rankInfo.frame;
|
||||
this.spine = rankInfo.spine;
|
||||
this.lv = rankInfo.lv;
|
||||
this.vLv = rankInfo.vLv;
|
||||
this.guildName = rankInfo.guildName;
|
||||
this.ce = rankInfo.ce;
|
||||
this.userInfo = pick(rankInfo, ['roleId', 'roleName', 'head', 'frame', 'spine', 'guildName', 'ce', 'title', 'lv']);
|
||||
this.num = rankInfo.num;
|
||||
this.received = received;
|
||||
}
|
||||
}
|
||||
|
||||
// 排行榜右边的数据
|
||||
export class GeneralRankParamBattle {
|
||||
type: number;
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
guildName: string;
|
||||
hid: number = 0;
|
||||
skinId: number = 0;
|
||||
num: number;
|
||||
received: number[];
|
||||
head: number;
|
||||
frame: number;
|
||||
spine: number;
|
||||
|
||||
constructor(type: number, rankInfo: RoleRankInfo, hero: HeroUpdate, received?: number[]) {
|
||||
this.type = type;
|
||||
this.roleId = rankInfo.roleId;
|
||||
this.roleName = rankInfo.roleName;
|
||||
this.guildName = rankInfo.guildName;
|
||||
this.num = rankInfo.num;
|
||||
this.head = rankInfo.head;
|
||||
this.frame = rankInfo.frame;
|
||||
this.spine = rankInfo.spine;
|
||||
if(hero) {
|
||||
this.hid = hero.hid;
|
||||
let curSkin = hero.skins.find(cur => cur.enable);
|
||||
this.skinId = curSkin?curSkin.id: 0;
|
||||
}
|
||||
this.received = received;
|
||||
}
|
||||
}
|
||||
@@ -61,5 +61,12 @@
|
||||
"group": 1,
|
||||
"groupName": "玩家",
|
||||
"general": 2
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"name": "军团",
|
||||
"group": 1,
|
||||
"groupName": "玩家",
|
||||
"general": 2
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user