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

This commit is contained in:
luying
2023-03-31 10:35:05 +08:00
parent f900179fbb
commit c865c475ff
9 changed files with 20 additions and 7 deletions

View File

@@ -791,7 +791,7 @@ export class HeroHandler {
// 设置副将
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接口 一键全武将

View File

@@ -19,7 +19,7 @@ export enum ROLE_SELECT {
export enum HERO_SELECT {
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字段
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'
}
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 {
FIND = '-__v -_id -surveyName -roleIndex -reward -mailContent -receivedRole -createdAt -updatedAt'

View File

@@ -354,7 +354,6 @@ export default class GVGTeam extends BaseModel {
}
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 } });
}
}

View File

@@ -56,7 +56,7 @@ export default class LadderMatch extends BaseModel {
public static async findByRoleIdAndInclude(roleId: string) {
const result: LadderMatchType = await LadderMatchModel.findOne({ roleId })
.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();
return result;
}
@@ -78,7 +78,7 @@ export default class LadderMatch extends BaseModel {
public static async updateByRoleIdAndInclude(roleId: string, params: LadderUpdateInter) {
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('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();
return defense;
}
@@ -98,7 +98,7 @@ export default class LadderMatch extends BaseModel {
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 })
.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();
return defense;
}

View File

@@ -359,6 +359,7 @@ export class LadderOppDetailHeroReturn {
spine: string = ''; // 动画
talent: Talent[] = [];
subHid: number = 0; // 副将
subActorId: number = 0;
artifact: HeroArtifact[] = [];
constructor(warJson: DicWarJson, defensHero: LadderDefenseHero, artifacts: ArtifactModelType[]) {
@@ -390,6 +391,7 @@ export class LadderOppDetailHeroReturn {
if(skin) this.talent = skin.talent;
this.job = hero.job;
this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
let artifact = artifacts.find(cur => cur.seqId == hero.artifact);
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv });
}

View File

@@ -52,6 +52,8 @@ export class PvpHeroInfo {
talent?: Talent[] = []; // 品质
@prop({ required: false })
subHid?: number = 0; // 副将
@prop({ required: false })
subActorId?: number = 0; // 副将
@prop({ required: true, _id: false })
attribute?: string; // 属性
@@ -70,6 +72,7 @@ export class PvpHeroInfo {
let skin = hero.skins?.find(cur => cur.enable);
if(skin) this.talent = skin.talent;
this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv })
}
@@ -176,6 +179,8 @@ export class PvpEnemies extends Enemies {
talent: Talent[];
@prop({ required: true })
subHid: number;
@prop({ required: true })
subActorId: number;
@prop({ required: true, type: () => HeroArtifact, _id: false })
artifact: HeroArtifact[] = []; // 宝物
@@ -190,6 +195,7 @@ export class PvpEnemies extends Enemies {
this.talent = heroInfo.talent;
this.job = heroInfo.job;
this.subHid = heroInfo.subHid;
this.subActorId = heroInfo.subActorId;
this.artifact = heroInfo.artifact||[];
if(score != undefined) this.score = score;
}

View File

@@ -171,6 +171,7 @@ export class OppDetailHeroData {
spine: string = ''; // 动画
talent: Talent[] = [];
subHid: number = 0; // 副将
subActorId: number = 0;
artifact: HeroArtifact[] = [];
constructor(warJson: DicWarJson, defensHero: OppPlayerHeroInfo, hero: HeroType, artifacts: ArtifactModelType[]) {
@@ -201,6 +202,7 @@ export class OppDetailHeroData {
if(skin) this.talent = skin.talent;
this.job = hero.job;
this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
let artifact = artifacts.find(cur => cur.seqId == hero.artifact);
if(artifact) this.artifact.push({ artifactId: artifact.artifactId, lv: artifact.lv });
}

View File

@@ -206,6 +206,7 @@ export class HeroDetailParam {
school: number;
};
subHid: number = 0;
subActorId: number = 0;
artifacts: {artifactId: number, lv: number }[] = []
constructor(hero: HeroType) {
@@ -228,6 +229,7 @@ export class HeroDetailParam {
}
this.connections = hero.connections;
this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
}
setAttributes(attributes: {hp: number, atk: number, def: number, mdef: number}) {

View File

@@ -63,6 +63,7 @@ export class HeroParam {
artifact: number = 0;
subHid: number = 0;
subActorId: number = 0;
talent: Talent[] = [];
usedTalentPoint: number = 0;
totalTalentPoint: number = 0;
@@ -98,6 +99,7 @@ export class HeroParam {
this.ePlace = hero.ePlace;
this.artifact = hero.artifact;
this.subHid = hero.subHid;
this.subActorId = hero.subActorId;
}
}