lrf 2 年之前
父節點
當前提交
fa95cb1c97
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      app/service/shop/goodsJoinAct.js

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

@@ -33,7 +33,6 @@ class GoodsJoinActService extends CrudService {
   }
 
   async query(filter, { skip = 0, limit, sort, desc, projection } = {}) {
-    console.log(filter);
     const { platform_act, platform_act_type, shop, shop_name, goods, goods_name, spec, spec_name, status } = filter;
     const mq = {};
     if (platform_act) mq.platform_act = platform_act;
@@ -61,6 +60,7 @@ class GoodsJoinActService extends CrudService {
     });
     pipeline.push({
       $project: {
+        meta: 1,
         shop: 1,
         shop_name: { $first: '$shopInfo.name' },
         goods: '$goods._id',
@@ -75,6 +75,7 @@ class GoodsJoinActService extends CrudService {
       },
     });
     const qPipeline = _.cloneDeep(pipeline);
+    qPipeline.push({ $sort: { 'meta.createdAt': -1 } });
     if (parseInt(skip)) qPipeline.push({ $skip: parseInt(skip) });
     if (parseInt(limit)) qPipeline.push({ $limit: parseInt(limit) });
     const res = await this.model.aggregate(qPipeline);