|
@@ -39,13 +39,14 @@ class GoodsService extends CrudService {
|
|
|
async indexGoodsList(condition, { skip = 0, limit = 20 } = {}) {
|
|
|
condition = this.dealFilter(condition);
|
|
|
const pipline = [{ $sort: { 'meta.createdAt': -1 } }, { $match: { status: { $ne: '0' } } }];
|
|
|
- const { view_num, sell_num, sell_money, name, shop } = condition;
|
|
|
+ const { view_num, sell_num, sell_money, name, shop, tags } = condition;
|
|
|
const sort = {};
|
|
|
if (view_num) sort.view_num = view_num;
|
|
|
if (sell_num) sort.sell_num = sell_num;
|
|
|
if (sell_money) sort.sell_money = sell_money;
|
|
|
if (name) pipline.push({ $match: { name: new RegExp(name) } });
|
|
|
if (shop) pipline.push({ $match: { shop } });
|
|
|
+ if (tags) pipline.push({ tags: { $elemMatch: { $elemMatch: { $eq: tags } } } });
|
|
|
|
|
|
pipline.push({ $addFields: { goods_id: { $toString: '$_id' } } });
|
|
|
// 表关联
|