添加百家学宫和名将谱,未计算战力

This commit is contained in:
luying
2020-12-25 15:01:32 +08:00
parent 432fa67105
commit 21ab617e90
13 changed files with 335 additions and 24 deletions

View File

@@ -66,6 +66,10 @@ interface heroUpdate {
connections?: Connect[];
ePlace?:EPlace[];
_id?:number;
scrollActive?: boolean;
scrollStar?: number;
scrollColorStar?: number;
scrollQuality?: number;
}
@index({ roleId: 1, hid: 1 })
@@ -109,6 +113,15 @@ export default class Hero extends BaseModel {
@prop({ required: true, default: 0 })
quality: number; // 品质
@prop({ required: true, default: false })
scrollActive: boolean; // 是否在名将谱中激活
@prop({ required: true, default: 0 })
scrollStar: number; // 名将谱中保存的星级
@prop({ required: true, default: 0 })
scrollColorStar: number; // 名将谱中保存的觉醒等级
@prop({ required: true, default: 0 })
scrollQuality: number; // 名将谱中保存的品质
@prop({ required: true, default: 0 })
job: number; // 职业
@prop({ required: true, default: 0 })
@@ -139,8 +152,8 @@ export default class Hero extends BaseModel {
const hero: HeroType = await HeroModel.findOne({ seqId, roleId }).lean(lean);
return hero;
}
public static async findByHidAndRole(hid: number, roleId: string, lean = true) {
const hero: HeroType = await HeroModel.findOne({ hid, roleId }).lean(lean);
public static async findByHidAndRole(hid: number, roleId: string, select?: string, lean = true) {
const hero: HeroType = await HeroModel.findOne({ hid, roleId }).select(select).lean(lean);
return hero;
}
@@ -204,9 +217,9 @@ export default class Hero extends BaseModel {
return result;
}
public static async updateHeroInfo(roleId: string, hid:number, heroUpdate:heroUpdate, lean = true) {
public static async updateHeroInfo(roleId: string, hid:number, heroUpdate:heroUpdate, select?: string, lean = true) {
delete heroUpdate._id;
let result: HeroType = await HeroModel.findOneAndUpdate({roleId, hid}, {$set:heroUpdate}).lean(lean);
let result: HeroType = await HeroModel.findOneAndUpdate({roleId, hid}, {$set:heroUpdate}, {new: true}).select(select).lean(lean);
return result;
}