🐞 fix(副将): 保存副将同时返回皮肤id和武将id

This commit is contained in:
luying
2023-03-31 10:36:02 +08:00
parent f900179fbb
commit c865c475ff
9 changed files with 20 additions and 7 deletions
@@ -791,7 +791,7 @@ export class HeroHandler {
// 设置副将 // 设置副将
const { preHid, curHero } = await HeroModel.setSubHero(roleId, hid, subSkinId, subHid); const { preHid, curHero } = await HeroModel.setSubHero(roleId, hid, subSkinId, subHid);
return resResult(STATUS.SUCCESS, { preHid, curHero: pick(curHero, ['hid', 'subHid']) }); return resResult(STATUS.SUCCESS, { preHid, curHero: pick(curHero, ['hid', 'subHid', 'subActorId']) });
} }
// ! debug接口 一键全武将 // ! debug接口 一键全武将
+2 -2
View File
@@ -19,7 +19,7 @@ export enum ROLE_SELECT {
export enum HERO_SELECT { export enum HERO_SELECT {
ENTRY = '-_id -attr -__v', ENTRY = '-_id -attr -__v',
HERO_DETAIL = 'roleId roleName hid hName ce lv star colorStar quality job skins attr ePlace skinId connections artifact subHid', HERO_DETAIL = 'roleId roleName hid hName ce lv star colorStar quality job skins attr ePlace skinId connections artifact subHid subActorId',
// 排行榜中lineup字段 // 排行榜中lineup字段
RANK_LINEUP = 'seqId roleId hid star colorStar lv quality job ce updatedAt skinId' RANK_LINEUP = 'seqId roleId hid star colorStar lv quality job ce updatedAt skinId'
} }
@@ -57,7 +57,7 @@ export enum FRIEND_SHIP_SELECT {
GET_FRIEND_VALUE = 'friendValue friendLv' GET_FRIEND_VALUE = 'friendValue friendLv'
} }
export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'jewels', 'artifacts', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins', 'totalPay', 'guide', 'hasInit', 'renameCnt', 'totalCost', 'guildName', 'isVip', 'createTime', 'ipLocation', 'activityItems']; export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'jewels', 'artifacts', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins', 'totalPay', 'guide', 'hasInit', 'renameCnt', 'totalCost', 'guildName', 'isVip', 'createTime', 'ipLocation', 'activityItems', 'customerLink'];
export enum SURVEY_SELECT { export enum SURVEY_SELECT {
FIND = '-__v -_id -surveyName -roleIndex -reward -mailContent -receivedRole -createdAt -updatedAt' FIND = '-__v -_id -surveyName -roleIndex -reward -mailContent -receivedRole -createdAt -updatedAt'
-1
View File
@@ -354,7 +354,6 @@ export default class GVGTeam extends BaseModel {
} }
public static async removeBySub(roleId: string, subHid: number, ce: number) { public static async removeBySub(roleId: string, subHid: number, ce: number) {
console.log('removeBySub', roleId, subHid, ce)
await GVGTeamModel.updateMany({ roleId, 'lineup.actorId': subHid }, { $pull: { lineup: { actorId: subHid } }, $inc: { lineupCe: -ce } }); await GVGTeamModel.updateMany({ roleId, 'lineup.actorId': subHid }, { $pull: { lineup: { actorId: subHid } }, $inc: { lineupCe: -ce } });
} }
} }
+3 -3
View File
@@ -56,7 +56,7 @@ export default class LadderMatch extends BaseModel {
public static async findByRoleIdAndInclude(roleId: string) { public static async findByRoleIdAndInclude(roleId: string) {
const result: LadderMatchType = await LadderMatchModel.findOne({ roleId }) const result: LadderMatchType = await LadderMatchModel.findOne({ roleId })
.populate('role', 'roleId roleName head frame spine heads frames spines title lv updatedAt') .populate('role', 'roleId roleName head frame spine heads frames spines title lv updatedAt')
.populate('defense.heroes.hero', 'hid skinId quality star colorStar lv skins job artifact subHid') .populate('defense.heroes.hero', 'hid skinId quality star colorStar lv skins job artifact subHid subActorId')
.lean(); .lean();
return result; return result;
} }
@@ -78,7 +78,7 @@ export default class LadderMatch extends BaseModel {
public static async updateByRoleIdAndInclude(roleId: string, params: LadderUpdateInter) { public static async updateByRoleIdAndInclude(roleId: string, params: LadderUpdateInter) {
const defense: LadderMatchType = await LadderMatchModel.findOneAndUpdate({ roleId }, { $set: params}, { new: true }) const defense: LadderMatchType = await LadderMatchModel.findOneAndUpdate({ roleId }, { $set: params}, { new: true })
.populate('role', 'roleId roleName head frame spine heads frames spines title lv updatedAt') .populate('role', 'roleId roleName head frame spine heads frames spines title lv updatedAt')
.populate('defense.heroes.hero', 'hid skinId quality star colorStar lv skins job artifact subHid') .populate('defense.heroes.hero', 'hid skinId quality star colorStar lv skins job artifact subHid subActorId')
.lean(); .lean();
return defense; return defense;
} }
@@ -98,7 +98,7 @@ export default class LadderMatch extends BaseModel {
public static async lock(serverId: number, roleId: string, rank: number) { public static async lock(serverId: number, roleId: string, rank: number) {
const defense: LadderMatchType = await LadderMatchModel.findOneAndUpdate({ serverId, roleId, rank, locked: 0 }, { $set: { locked: 1 }}, { new: true }) const defense: LadderMatchType = await LadderMatchModel.findOneAndUpdate({ serverId, roleId, rank, locked: 0 }, { $set: { locked: 1 }}, { new: true })
.populate('role', 'roleId roleName head frame spine heads frames spines title lv updatedAt') .populate('role', 'roleId roleName head frame spine heads frames spines title lv updatedAt')
.populate('defense.heroes.hero', 'hid skinId quality star colorStar lv skins job artifact subHid') .populate('defense.heroes.hero', 'hid skinId quality star colorStar lv skins job artifact subHid subActorId')
.lean(); .lean();
return defense; return defense;
} }
+2
View File
@@ -359,6 +359,7 @@ export class LadderOppDetailHeroReturn {
spine: string = ''; // 动画 spine: string = ''; // 动画
talent: Talent[] = []; talent: Talent[] = [];
subHid: number = 0; // 副将 subHid: number = 0; // 副将
subActorId: number = 0;
artifact: HeroArtifact[] = []; artifact: HeroArtifact[] = [];
constructor(warJson: DicWarJson, defensHero: LadderDefenseHero, artifacts: ArtifactModelType[]) { constructor(warJson: DicWarJson, defensHero: LadderDefenseHero, artifacts: ArtifactModelType[]) {
@@ -390,6 +391,7 @@ export class LadderOppDetailHeroReturn {
if(skin) this.talent = skin.talent; if(skin) this.talent = skin.talent;
this.job = hero.job; this.job = hero.job;
this.subHid = hero.subHid; this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
let artifact = artifacts.find(cur => cur.seqId == hero.artifact); let artifact = artifacts.find(cur => cur.seqId == hero.artifact);
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv }); if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv });
} }
+6
View File
@@ -52,6 +52,8 @@ export class PvpHeroInfo {
talent?: Talent[] = []; // 品质 talent?: Talent[] = []; // 品质
@prop({ required: false }) @prop({ required: false })
subHid?: number = 0; // 副将 subHid?: number = 0; // 副将
@prop({ required: false })
subActorId?: number = 0; // 副将
@prop({ required: true, _id: false }) @prop({ required: true, _id: false })
attribute?: string; // 属性 attribute?: string; // 属性
@@ -70,6 +72,7 @@ export class PvpHeroInfo {
let skin = hero.skins?.find(cur => cur.enable); let skin = hero.skins?.find(cur => cur.enable);
if(skin) this.talent = skin.talent; if(skin) this.talent = skin.talent;
this.subHid = hero.subHid; this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv }) if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv })
} }
@@ -176,6 +179,8 @@ export class PvpEnemies extends Enemies {
talent: Talent[]; talent: Talent[];
@prop({ required: true }) @prop({ required: true })
subHid: number; subHid: number;
@prop({ required: true })
subActorId: number;
@prop({ required: true, type: () => HeroArtifact, _id: false }) @prop({ required: true, type: () => HeroArtifact, _id: false })
artifact: HeroArtifact[] = []; // 宝物 artifact: HeroArtifact[] = []; // 宝物
@@ -190,6 +195,7 @@ export class PvpEnemies extends Enemies {
this.talent = heroInfo.talent; this.talent = heroInfo.talent;
this.job = heroInfo.job; this.job = heroInfo.job;
this.subHid = heroInfo.subHid; this.subHid = heroInfo.subHid;
this.subActorId = heroInfo.subActorId;
this.artifact = heroInfo.artifact||[]; this.artifact = heroInfo.artifact||[];
if(score != undefined) this.score = score; if(score != undefined) this.score = score;
} }
+2
View File
@@ -171,6 +171,7 @@ export class OppDetailHeroData {
spine: string = ''; // 动画 spine: string = ''; // 动画
talent: Talent[] = []; talent: Talent[] = [];
subHid: number = 0; // 副将 subHid: number = 0; // 副将
subActorId: number = 0;
artifact: HeroArtifact[] = []; artifact: HeroArtifact[] = [];
constructor(warJson: DicWarJson, defensHero: OppPlayerHeroInfo, hero: HeroType, artifacts: ArtifactModelType[]) { constructor(warJson: DicWarJson, defensHero: OppPlayerHeroInfo, hero: HeroType, artifacts: ArtifactModelType[]) {
@@ -201,6 +202,7 @@ export class OppDetailHeroData {
if(skin) this.talent = skin.talent; if(skin) this.talent = skin.talent;
this.job = hero.job; this.job = hero.job;
this.subHid = hero.subHid; this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
let artifact = artifacts.find(cur => cur.seqId == hero.artifact); let artifact = artifacts.find(cur => cur.seqId == hero.artifact);
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv }); if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv });
} }
+2
View File
@@ -206,6 +206,7 @@ export class HeroDetailParam {
school: number; school: number;
}; };
subHid: number = 0; subHid: number = 0;
subActorId: number = 0;
artifacts: {artifactId: number, lv: number }[] = [] artifacts: {artifactId: number, lv: number }[] = []
constructor(hero: HeroType) { constructor(hero: HeroType) {
@@ -228,6 +229,7 @@ export class HeroDetailParam {
} }
this.connections = hero.connections; this.connections = hero.connections;
this.subHid = hero.subHid; this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
} }
setAttributes(attributes: {hp: number, atk: number, def: number, mdef: number}) { setAttributes(attributes: {hp: number, atk: number, def: number, mdef: number}) {
+2
View File
@@ -63,6 +63,7 @@ export class HeroParam {
artifact: number = 0; artifact: number = 0;
subHid: number = 0; subHid: number = 0;
subActorId: number = 0;
talent: Talent[] = []; talent: Talent[] = [];
usedTalentPoint: number = 0; usedTalentPoint: number = 0;
totalTalentPoint: number = 0; totalTalentPoint: number = 0;
@@ -98,6 +99,7 @@ export class HeroParam {
this.ePlace = hero.ePlace; this.ePlace = hero.ePlace;
this.artifact = hero.artifact; this.artifact = hero.artifact;
this.subHid = hero.subHid; this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
} }
} }