Showing
3 changed files
with
37 additions
and
6 deletions
@@ -47,12 +47,25 @@ exports.index = (req, res, next) => { | @@ -47,12 +47,25 @@ exports.index = (req, res, next) => { | ||
47 | * 潮流优选首页-资源位 | 47 | * 潮流优选首页-资源位 |
48 | */ | 48 | */ |
49 | exports.resourcesTemplate = (req, res, next) => { | 49 | exports.resourcesTemplate = (req, res, next) => { |
50 | - let code = req.query.code || ''; | ||
51 | let isApp = req.query.app_version || req.query.appVersion || false; | 50 | let isApp = req.query.app_version || req.query.appVersion || false; |
51 | + let uid = ''; | ||
52 | + let param = {}; | ||
52 | 53 | ||
53 | - plusstarModel.getResources({ | ||
54 | - content_code: code | ||
55 | - }, { | 54 | + if (req.yoho.isApp) { |
55 | + uid = req.query.uid; | ||
56 | + } else { | ||
57 | + uid = req.user.uid; | ||
58 | + } | ||
59 | + | ||
60 | + if (uid) { | ||
61 | + param.uid = uid; | ||
62 | + } | ||
63 | + | ||
64 | + param.content_code = req.query.code || ''; | ||
65 | + param.yh_channel = req.query.yh_channel || 1; | ||
66 | + | ||
67 | + | ||
68 | + plusstarModel.getResourcesData(param, { | ||
56 | isApp: isApp | 69 | isApp: isApp |
57 | }).then(result => { | 70 | }).then(result => { |
58 | res.render('plusstar/resources-template', { | 71 | res.render('plusstar/resources-template', { |
@@ -158,9 +158,26 @@ const getResources = (params, options) => { | @@ -158,9 +158,26 @@ const getResources = (params, options) => { | ||
158 | }); | 158 | }); |
159 | }; | 159 | }; |
160 | 160 | ||
161 | +const getResourcesData = (params, options) => { | ||
162 | + return api.all([ | ||
163 | + getResources(params, options), | ||
164 | + getFashionPrefer(params) | ||
165 | + ]).then(result => { | ||
166 | + let skns = result[0] && result[0].goods && result[0].goods.productSkns || []; | ||
167 | + let preferSkns = result[1] && result[1].data || []; | ||
168 | + | ||
169 | + if (result[0] && result[0].goods && result[0].goods.productSkns) { | ||
170 | + result[0].goods.productSkns = _.uniq(Object.assign(preferSkns, skns)); | ||
171 | + } | ||
172 | + | ||
173 | + return result[0]; | ||
174 | + }); | ||
175 | +}; | ||
176 | + | ||
161 | module.exports = { | 177 | module.exports = { |
162 | getAllChannels, | 178 | getAllChannels, |
163 | getResources, | 179 | getResources, |
164 | getFashionPrefer, | 180 | getFashionPrefer, |
165 | - getProductBatch | 181 | + getProductBatch, |
182 | + getResourcesData | ||
166 | }; | 183 | }; |
@@ -250,7 +250,8 @@ plusstar = { | @@ -250,7 +250,8 @@ plusstar = { | ||
250 | timeout: 5000, | 250 | timeout: 5000, |
251 | data: { | 251 | data: { |
252 | productSkn: skn.join(','), | 252 | productSkn: skn.join(','), |
253 | - app_version: window.queryString.app_version || window.queryString.appVersion | 253 | + app_version: window.queryString.app_version || window.queryString.appVersion, |
254 | + yh_channel: that.ParentLiDom.index() + 1 | ||
254 | }, | 255 | }, |
255 | dataType: 'html', | 256 | dataType: 'html', |
256 | success: function(data) { | 257 | success: function(data) { |
-
Please register or login to post a comment