🐞 fix(gvg): 遗迹编队战力未变动

This commit is contained in:
luying
2023-02-24 18:03:23 +08:00
parent 3cde1f37fe
commit 42401b317f
3 changed files with 6 additions and 1 deletions
@@ -20,6 +20,7 @@ import { sendMessageToUserWithSuc } from './pushService';
import { SkinType } from '../db/Skin'; import { SkinType } from '../db/Skin';
import { LadderMatchModel } from '../db/LadderMatch'; import { LadderMatchModel } from '../db/LadderMatch';
import { ArtifactModelType } from '../db/Artifact'; import { ArtifactModelType } from '../db/Artifact';
import { GVGVestigeRankModel } from '../db/GVGVestigeRank';
interface Param { interface Param {
isInitRole?: boolean, isInitRole?: boolean,
@@ -430,6 +431,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
heroes.push(hero); heroes.push(hero);
await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力 await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力
await LadderMatchModel.updateCe(roleId, hid, ce); await LadderMatchModel.updateCe(roleId, hid, ce);
await GVGVestigeRankModel.updateCe(roleId, hid, ce);
pushHeros.push({ hid, ce, incHeroCe: inc }); pushHeros.push({ hid, ce, incHeroCe: inc });
} else { } else {
let hero = await HeroModel.updateHeroInfo(roleId, hid, heroUpdate); let hero = await HeroModel.updateHeroInfo(roleId, hid, heroUpdate);
@@ -441,6 +443,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
let hero = await HeroModel.updateHeroInfo(roleId, hid, { ce }); let hero = await HeroModel.updateHeroInfo(roleId, hid, { ce });
await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力 await PvpDefenseModel.updateCe(roleId, hid, ce); // 更新pvp防守阵战力
await LadderMatchModel.updateCe(roleId, hid, ce); await LadderMatchModel.updateCe(roleId, hid, ce);
await GVGVestigeRankModel.updateCe(roleId, hid, ce);
pushHeros.push({ hid, ce: hero.ce, incHeroCe: inc }); pushHeros.push({ hid, ce: hero.ce, incHeroCe: inc });
} }
} }
+1 -1
View File
@@ -101,7 +101,7 @@ export default class GVGVestigeRank extends BaseModel {
public static async updateCe(roleId: string, hid: number, ce: number) { public static async updateCe(roleId: string, hid: number, ce: number) {
let today = getZeroPoint(); let today = getZeroPoint();
await GVGVestigeRankModel.updateMany({ day: today, hasDefense: true, roleId, 'lineup.hid': hid }, { $set: { 'lineup.$.ce': ce } }); await GVGVestigeRankModel.updateMany({ day: today, hasDefense: true, roleId, 'lineup.actorId': hid }, { $set: { 'lineup.$.ce': ce } });
} }
public static async changeRank(isSuccess: boolean, vestigeId: number, attackInfo: { roleId: string }, defenseInfo: { isRobot: boolean, roleId: string, oldRank: number }): Promise<{ isChange: boolean, atkData?: GVGVestigeRankType, defData?: GVGVestigeRankType, endTime: number }> { public static async changeRank(isSuccess: boolean, vestigeId: number, attackInfo: { roleId: string }, defenseInfo: { isRobot: boolean, roleId: string, oldRank: number }): Promise<{ isChange: boolean, atkData?: GVGVestigeRankType, defData?: GVGVestigeRankType, endTime: number }> {
+2
View File
@@ -96,6 +96,8 @@ export default class GVGVestigeRec extends BaseModel {
if(atkNewRank != undefined && defNewRank != undefined) { if(atkNewRank != undefined && defNewRank != undefined) {
update['attackInfo.newRank'] = atkNewRank; update['attackInfo.newRank'] = atkNewRank;
update['defenseInfo.newRank'] = defNewRank; update['defenseInfo.newRank'] = defNewRank;
update['attackInfo.oldRank'] = isSuccess? defNewRank: atkNewRank;
update['defenseInfo.oldRank'] = isSuccess? atkNewRank: defNewRank;
} }
const result: GVGVestigeRecType = await GVGVestigeRecModel.findOneAndUpdate({ battleCode }, { $set: update }, { new: true }).lean(); const result: GVGVestigeRecType = await GVGVestigeRecModel.findOneAndUpdate({ battleCode }, { $set: update }, { new: true }).lean();