lrf 2 lat temu
rodzic
commit
27a6536766

+ 1 - 0
app/controller/shop/config/.goodsJoinAct.js

@@ -32,6 +32,7 @@ module.exports = {
         status: 'status',
         tags: 'tags',
         act_tags: 'act_tags',
+        goods_type: 'goods_type',
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 8 - 1
app/service/shop/goodsJoinAct.js

@@ -37,7 +37,7 @@ class GoodsJoinActService extends CrudService {
   }
 
   async query(filter, { skip = 0, limit, sort, desc, projection } = {}) {
-    const { platform_act, platform_act_type, shop, shop_name, goods, goods_name, spec, spec_name, status } = filter;
+    const { platform_act, platform_act_type, shop, shop_name, goods, goods_name, spec, spec_name, status, goods_type = 'basic' } = filter;
     const mq = {};
     if (platform_act) mq.platform_act = platform_act;
     if (platform_act_type) mq.platform_act_type = platform_act_type;
@@ -48,6 +48,12 @@ class GoodsJoinActService extends CrudService {
     if (spec_name) mq['spec.name'] = new RegExp(spec_name);
     if (status) mq.status = status;
     const pipeline = [];
+    // 将加价购的加价商品过滤掉,正常列表中不显示加价购商品. 如果需要显示加价购商品,goods_type的值为plus即可
+    pipeline.push({
+      $match: {
+        $or: [{ platform_act_type: '4', 'config.goods_type': goods_type }, { platform_act_type: { $ne: '4' } }],
+      },
+    });
     if (Object.keys(mq).length > 0) pipeline.push({ $match: mq });
     pipeline.push({ $addFields: { shop_id: { $toObjectId: '$shop' } } });
     const sp = [];
@@ -85,6 +91,7 @@ class GoodsJoinActService extends CrudService {
         sell_money: { $toString: '$spec.sell_money' },
         flow_money: { $toString: '$spec.flow_money' },
         platform_act_type: 1,
+        config: 1,
         status: 1,
       },
     });