寻宝:藏宝图查询

This commit is contained in:
liangtongchuan
2020-12-04 18:10:10 +08:00
parent 5367e85ad7
commit 28bc9118bc
2 changed files with 30 additions and 1 deletions
+10
View File
@@ -26,6 +26,16 @@ export default class Item extends BaseModel {
return items;
}
public static async findbyRoleAndIds(roleId: string, ids: Array<number>, lean = true) {
const items = await ItemModel.find({ roleId, id: {$in: ids} }).select('id count type').lean(lean);
return items;
}
public static async findByRoleAndType(roleId: string, type: number, lean = true) {
const items = await ItemModel.find({ roleId, type }).select('id count type').lean(lean);
return items;
}
public static async findbyRoleAndGidAndCount(roleId: string, id: number, count: number, lean = true) {
const items = await ItemModel.findOne({ roleId, id, count: {$gte: count} }).select('id count type').lean(lean);
return items;