🎈 perf(排行榜): 武将排行榜修改为读数据库
This commit is contained in:
@@ -101,6 +101,8 @@ export class EPlace {
|
||||
@index({ seqId: 1 })
|
||||
@index({ roleId: 1, hid: 1 })
|
||||
@index({ roleId: 1, ce: -1 })
|
||||
@index({ serverId: 1, ce: -1 })
|
||||
@index({ serverId: 1, hid: 1, ce: -1 })
|
||||
export default class Hero extends BaseModel {
|
||||
|
||||
@prop({ required: true })
|
||||
@@ -188,6 +190,16 @@ export default class Hero extends BaseModel {
|
||||
return heroes
|
||||
}
|
||||
|
||||
public static async findByServerIdAndSortByCe(serverId: number) {
|
||||
const heroes: HeroType[] = await HeroROModel.find({ serverId }).sort({ ce: -1 }).select('hid skinId star colorStar lv quality job roleId ce').limit(200).lean();
|
||||
return heroes
|
||||
}
|
||||
|
||||
public static async findByServerIdAndHidAndSortByCe(serverId: number, hid: number) {
|
||||
const heroes: HeroType[] = await HeroROModel.find({ serverId, hid }).sort({ ce: -1 }).select('hid skinId star colorStar lv quality job roleId ce').limit(200).lean();
|
||||
return heroes
|
||||
}
|
||||
|
||||
public static async findBySeqIdRange(seqIds: Array<number>, roleId: string, lean = true) {
|
||||
const hero: HeroType[] = await HeroROModel.find({ seqId: { $in: seqIds }, roleId }).lean(lean);
|
||||
return hero;
|
||||
|
||||
Reference in New Issue
Block a user