feat(好友): 展示阵容优化

This commit is contained in:
luying
2023-04-12 11:41:05 +08:00
parent 5a71e19f03
commit fdd06a5fe7
3 changed files with 26 additions and 16 deletions

View File

@@ -100,6 +100,7 @@ export class EPlace {
@index({ seqId: 1 })
@index({ roleId: 1, hid: 1 })
@index({ roleId: 1, ce: -1 })
export default class Hero extends BaseModel {
@prop({ required: true })
@@ -182,6 +183,11 @@ export default class Hero extends BaseModel {
return heros;
}
public static async findAndSortByCe(roleId: string) {
const heroes: HeroType[] = await HeroModel.find({ roleId }).sort({ ce: -1 }).lean();
return heroes
}
public static async findBySeqIdRange(seqIds: Array<number>, roleId: string, lean = true) {
const hero: HeroType[] = await HeroModel.find({ seqId: { $in: seqIds }, roleId }).lean(lean);
return hero;