|
@@ -60,8 +60,10 @@ class GoodsService extends CrudService {
|
|
});
|
|
});
|
|
// 按照规格平铺数据
|
|
// 按照规格平铺数据
|
|
pipline.push({ $unwind: '$specs' });
|
|
pipline.push({ $unwind: '$specs' });
|
|
- // // 格式化平铺后的数据
|
|
|
|
- pipline.push({ $project: { name: 1, view_num: 1, sell_num: 1, file: 1, sell_money: { $toDouble: '$specs.sell_money' }, createdAt: '$meta.createdAt' } });
|
|
|
|
|
|
+ // 格式化平铺后的数据
|
|
|
|
+ // 2022-10-17反馈-问题6:将规格图片也拿出来
|
|
|
|
+ // TODO: 整理规格图片与正常的商品图片
|
|
|
|
+ pipline.push({ $project: { name: 1, view_num: 1, sell_num: 1, file: 1, sell_money: { $toDouble: '$specs.sell_money' }, createdAt: '$meta.createdAt' }, spec_file: '$specs.file' });
|
|
pipline.push({
|
|
pipline.push({
|
|
$group: {
|
|
$group: {
|
|
_id: '$_id',
|
|
_id: '$_id',
|
|
@@ -70,6 +72,7 @@ class GoodsService extends CrudService {
|
|
sell_num: { $first: '$sell_num' },
|
|
sell_num: { $first: '$sell_num' },
|
|
sell_money: { $min: '$sell_money' },
|
|
sell_money: { $min: '$sell_money' },
|
|
file: { $first: '$file' },
|
|
file: { $first: '$file' },
|
|
|
|
+ spec_file: { $first: 'spec_file' },
|
|
createdAt: { $first: '$createdAt' },
|
|
createdAt: { $first: '$createdAt' },
|
|
},
|
|
},
|
|
});
|
|
});
|