pvp:修复赛季相关
This commit is contained in:
@@ -149,7 +149,10 @@ export default class PvpDefense extends BaseModel {
|
||||
}
|
||||
|
||||
public static async resetScores(roleId: string, newSeasonNum: number, newScore: number, newHeroScores: HeroScore[]) {
|
||||
let result: PvpDefenseType = await PvpDefenseModel.findOneAndUpdate({roleId}, {$set: { seasonNum: newSeasonNum, score: newScore, heroScores: newHeroScores, challengeCnt: PVP.PVP_CHALLENGE_COUNTS, challengeRefTime: 0, winStreakNum: 0 }}, {new: true}).lean();
|
||||
let result: PvpDefenseType = await PvpDefenseModel.findOneAndUpdate({roleId}, {$set: { seasonNum: newSeasonNum, score: newScore, heroScores: newHeroScores, challengeCnt: PVP.PVP_CHALLENGE_COUNTS, challengeRefTime: 0, winStreakNum: 0 }}, {new: true})
|
||||
.populate('role', 'roleId roleName head frame spine heads frames spines title lv vLv')
|
||||
.populate('oppPlayers.oppDef', 'oppRoleId pos roleName head frame spine heads frames spines rankLv pLv title lv defCe heroes warId buff').lean({ getters: true, virtuals: true })
|
||||
.lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,11 +39,12 @@ export default class PvpSeasonResult extends BaseModel {
|
||||
newHeroScores: HeroScore[];
|
||||
|
||||
public static async updatePvpSeasonResult(roleId: string, seasonNum: number, update: PvpSeasonResultUpdate , lean = true) {
|
||||
delete update._id;
|
||||
let result: PvpSeasonResultType = await PvpSeasonResultModel.findOneAndUpdate({roleId, seasonNum}, {$set: update}, {upsert: true, new: true}).lean(lean);
|
||||
return result;
|
||||
}
|
||||
public static async getPvpSeasonResult(roleId: string, seasonNum: number, lean = true) {
|
||||
let result: PvpSeasonResultType = await PvpSeasonResultModel.findOne({ roleId, seasonNum }).lean(lean);
|
||||
public static async getPvpSeasonResult(roleId: string) {
|
||||
let result: PvpSeasonResultType = await PvpSeasonResultModel.findOne({ roleId, show: true }).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user