|
@@ -76,14 +76,16 @@ class IndexService extends CrudService {
|
|
return token;
|
|
return token;
|
|
}
|
|
}
|
|
|
|
|
|
- async dockProduct({ dock_id, type, skip = 0, limit = 10 } = {}) {
|
|
|
|
|
|
+ async dockProduct({ dock_id, type, field, skip = 0, limit = 10 } = {}) {
|
|
assert(dock_id, '缺少展会信息');
|
|
assert(dock_id, '缺少展会信息');
|
|
assert(type, '要查询的类型');
|
|
assert(type, '要查询的类型');
|
|
|
|
+ const query = { 'goodsList.status': '1' };
|
|
|
|
+ if (field) query['goodsList.field'] = field;
|
|
const res = await this.dockUser.aggregate([
|
|
const res = await this.dockUser.aggregate([
|
|
{ $match: { dock_id: ObjectId(dock_id), 'goodsList.type': type } },
|
|
{ $match: { dock_id: ObjectId(dock_id), 'goodsList.type': type } },
|
|
{ $project: { goodsList: 1 } },
|
|
{ $project: { goodsList: 1 } },
|
|
{ $unwind: '$goodsList' },
|
|
{ $unwind: '$goodsList' },
|
|
- { $match: { 'goodsList.status': '1' } },
|
|
|
|
|
|
+ { $match: query },
|
|
]);
|
|
]);
|
|
const list = res.map(i => i.goodsList);
|
|
const list = res.map(i => i.goodsList);
|
|
return { data: _.slice(list, skip, skip + limit), total: list.length };
|
|
return { data: _.slice(list, skip, skip + limit), total: list.length };
|