优化:减少初始以及合成武将时返回的数据
This commit is contained in:
@@ -25,8 +25,8 @@ export default class Item extends BaseModel {
|
||||
count: number; // 道具数量
|
||||
|
||||
|
||||
public static async findbyRole(roleId: string, lean = true) {
|
||||
const items: ItemType[] = await ItemModel.find({ roleId, count: {$gte: 0} }).select('id count type').lean(lean);
|
||||
public static async findbyRole(roleId: string, select = '') {
|
||||
const items: ItemType[] = await ItemModel.find({ roleId, count: {$gte: 0} }).select(select).lean();
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ export default class Jewel extends BaseModel {
|
||||
@prop({ required: false, type: RandSe, default: [], _id: false })
|
||||
previewRandSe: RandSe[]; // 强化随机属性预览
|
||||
|
||||
public static async findbyRole(roleId: string, lean = true) {
|
||||
const jewels: JewelType[] = await JewelModel.find({ roleId }).lean(lean);
|
||||
public static async findbyRole(roleId: string, select = '') {
|
||||
const jewels: JewelType[] = await JewelModel.find({ roleId }).select(select).lean();
|
||||
return jewels;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ export default class Skin extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
hid: number; // 原始武将id
|
||||
|
||||
public static async findbyRole(roleId: string) {
|
||||
const rec: SkinType[] = await SkinModel.find({ roleId }, {_id: 0}).select('id skinId skinName hid').lean();
|
||||
public static async findbyRole(roleId: string, select = '') {
|
||||
const rec: SkinType[] = await SkinModel.find({ roleId }).select(select).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user