Merge branch 'feature/1215' into release/6.9.17
Showing
2 changed files
with
41 additions
and
0 deletions
@@ -24,6 +24,25 @@ exports.productLst = function(req, res, next) { | @@ -24,6 +24,25 @@ exports.productLst = function(req, res, next) { | ||
24 | order: req.query.order || 'pool_id_desc', | 24 | order: req.query.order || 'pool_id_desc', |
25 | filter_poolId: req.query.filter_poolId || '' | 25 | filter_poolId: req.query.filter_poolId || '' |
26 | }, req.query)); | 26 | }, req.query)); |
27 | + } else if (req.query.is_ufo === 'Y') { | ||
28 | + let keys = ['product_id', 'productPool', 'sort', 'brand', 'series', 'size']; | ||
29 | + let params = { | ||
30 | + uid: uid, | ||
31 | + udid: udid, | ||
32 | + limit: 20 | ||
33 | + }; | ||
34 | + | ||
35 | + keys.forEach(function(k) { | ||
36 | + if (req.query[k]) { | ||
37 | + params[k] = req.query[k]; | ||
38 | + } | ||
39 | + }); | ||
40 | + | ||
41 | + if (req.query.limit < 100) { | ||
42 | + params.limit = req.query.limit; | ||
43 | + } | ||
44 | + | ||
45 | + getProductList = req.ctx(model).ufoProductList(params); | ||
27 | } else { | 46 | } else { |
28 | let keys = ['sort', 'misort', 'msort', 'gender', 'brand'], | 47 | let keys = ['sort', 'misort', 'msort', 'gender', 'brand'], |
29 | params = { | 48 | params = { |
1 | 'use strict'; | 1 | 'use strict'; |
2 | const _ = require('lodash'); | 2 | const _ = require('lodash'); |
3 | +const UfoApi = global.yoho.UfoAPI; | ||
3 | 4 | ||
4 | let _getProduct = function(o) { | 5 | let _getProduct = function(o) { |
5 | let plan = o.product_price_plan_list; | 6 | let plan = o.product_price_plan_list; |
@@ -99,6 +100,27 @@ class individuationModel extends global.yoho.BaseModel { | @@ -99,6 +100,27 @@ class individuationModel extends global.yoho.BaseModel { | ||
99 | return data; | 100 | return data; |
100 | }); | 101 | }); |
101 | } | 102 | } |
103 | + ufoProductList(params) { | ||
104 | + return this.get({ | ||
105 | + data: Object.assign({ | ||
106 | + method: 'ufo.product.search.common.list' | ||
107 | + }, params), | ||
108 | + api: UfoApi | ||
109 | + }).then(res => { | ||
110 | + let data = [], | ||
111 | + list = (res && res.data && res.data.product_list) || []; | ||
112 | + | ||
113 | + list.forEach(function(o) { | ||
114 | + if (o) { | ||
115 | + o.sales_price = o.price; | ||
116 | + o.market_price = 0; | ||
117 | + data.push(_getProduct(o)); | ||
118 | + } | ||
119 | + }); | ||
120 | + | ||
121 | + return data; | ||
122 | + }); | ||
123 | + } | ||
102 | getCoupon(params) { | 124 | getCoupon(params) { |
103 | return this.get({ | 125 | return this.get({ |
104 | data: Object.assign({ | 126 | data: Object.assign({ |
-
Please register or login to post a comment