lrf 2 years ago
parent
commit
a7601220c0
1 changed files with 5 additions and 5 deletions
  1. 5 5
      app/service/view/goods.js

+ 5 - 5
app/service/view/goods.js

@@ -75,8 +75,6 @@ class GoodsService extends CrudService {
         sell_money: { $toDouble: '$specs.sell_money' },
         flow_money: { $toDouble: '$specs.flow_money' },
         num: '$specs.num',
-        createdAt: '$meta.createdAt',
-        spec_file: '$specs.file',
       },
     });
     pipline.push({
@@ -94,8 +92,6 @@ class GoodsService extends CrudService {
         sell_money: '$data.sell_money',
         flow_money: '$data.flow_money',
         num: '$data.num',
-        createdAt: '$data.createdAt',
-        spec_file: '$data.spec_file',
         create_time: '$data.create_time',
         sort: '$data.sort',
       },
@@ -106,7 +102,11 @@ class GoodsService extends CrudService {
     const qPipline = _.cloneDeep(pipline);
     if (parseInt(skip)) qPipline.push({ $skip: parseInt(skip) });
     if (parseInt(limit)) qPipline.push({ $limit: parseInt(limit) });
-    const list = await this.goodsModel.aggregate(qPipline);
+    let list = await this.goodsModel.aggregate(qPipline);
+    list = list.map(i => {
+      const obj = _.pick(i, [ 'name', 'file', 'num', 'flow_money', 'sell_money', 'view_num', '_id' ]);
+      return obj;
+    });
     const tPipline = _.cloneDeep(pipline);
     tPipline.push({ $count: 'total' });
     const total = await this.goodsModel.aggregate(tPipline);