|
@@ -2,7 +2,7 @@ |
|
@@ -2,7 +2,7 @@ |
2
|
const _ = require('lodash');
|
2
|
const _ = require('lodash');
|
3
|
const UfoApi = global.yoho.UfoAPI;
|
3
|
const UfoApi = global.yoho.UfoAPI;
|
4
|
|
4
|
|
5
|
-let _getProduct = function(o) {
|
5
|
+let _getProduct = function(o, type) {
|
6
|
let plan = o.product_price_plan_list;
|
6
|
let plan = o.product_price_plan_list;
|
7
|
let res = {
|
7
|
let res = {
|
8
|
small_sort_id: o.small_sort_id,
|
8
|
small_sort_id: o.small_sort_id,
|
|
@@ -25,7 +25,8 @@ let _getProduct = function(o) { |
|
@@ -25,7 +25,8 @@ let _getProduct = function(o) { |
25
|
cn_alphabet: o.cn_alphabet,
|
25
|
cn_alphabet: o.cn_alphabet,
|
26
|
default_images: o.default_images,
|
26
|
default_images: o.default_images,
|
27
|
total_sales_num: o.total_sales_num || 0,
|
27
|
total_sales_num: o.total_sales_num || 0,
|
28
|
- goods_id: Array.isArray(o.goods_list) && o.goods_list.length ? o.goods_list[0].goods_id : void 0
|
28
|
+ goods_id: Array.isArray(o.goods_list) && o.goods_list.length ? o.goods_list[0].goods_id : void 0,
|
|
|
29
|
+ type: type || 'yoho'
|
29
|
};
|
30
|
};
|
30
|
|
31
|
|
31
|
plan = _.sortBy(plan, item => {
|
32
|
plan = _.sortBy(plan, item => {
|
|
@@ -112,9 +113,13 @@ class individuationModel extends global.yoho.BaseModel { |
|
@@ -112,9 +113,13 @@ class individuationModel extends global.yoho.BaseModel { |
112
|
|
113
|
|
113
|
list.forEach(function(o) {
|
114
|
list.forEach(function(o) {
|
114
|
if (o) {
|
115
|
if (o) {
|
115
|
- o.sales_price = o.price;
|
|
|
116
|
- o.market_price = 0;
|
|
|
117
|
- data.push(_getProduct(o));
|
116
|
+ Object.assign(o, {
|
|
|
117
|
+ product_id: o.id,
|
|
|
118
|
+ sales_price: o.price,
|
|
|
119
|
+ market_price: 0,
|
|
|
120
|
+ total_sales_num: o.sales
|
|
|
121
|
+ });
|
|
|
122
|
+ data.push(_getProduct(o, 'ufo'));
|
118
|
}
|
123
|
}
|
119
|
});
|
124
|
});
|
120
|
|
125
|
|