Authored by 郝肖肖

潮流优选,商品列表获取

... ... @@ -47,12 +47,25 @@ exports.index = (req, res, next) => {
* 潮流优选首页-资源位
*/
exports.resourcesTemplate = (req, res, next) => {
let code = req.query.code || '';
let isApp = req.query.app_version || req.query.appVersion || false;
let uid = '';
let param = {};
plusstarModel.getResources({
content_code: code
}, {
if (req.yoho.isApp) {
uid = req.query.uid;
} else {
uid = req.user.uid;
}
if (uid) {
param.uid = uid;
}
param.content_code = req.query.code || '';
param.yh_channel = req.query.yh_channel || 1;
plusstarModel.getResourcesData(param, {
isApp: isApp
}).then(result => {
res.render('plusstar/resources-template', {
... ...
... ... @@ -158,9 +158,26 @@ const getResources = (params, options) => {
});
};
const getResourcesData = (params, options) => {
return api.all([
getResources(params, options),
getFashionPrefer(params)
]).then(result => {
let skns = result[0] && result[0].goods && result[0].goods.productSkns || [];
let preferSkns = result[1] && result[1].data || [];
if (result[0] && result[0].goods && result[0].goods.productSkns) {
result[0].goods.productSkns = _.uniq(Object.assign(preferSkns, skns));
}
return result[0];
});
};
module.exports = {
getAllChannels,
getResources,
getFashionPrefer,
getProductBatch
getProductBatch,
getResourcesData
};
... ...
... ... @@ -250,7 +250,8 @@ plusstar = {
timeout: 5000,
data: {
productSkn: skn.join(','),
app_version: window.queryString.app_version || window.queryString.appVersion
app_version: window.queryString.app_version || window.queryString.appVersion,
yh_channel: that.ParentLiDom.index() + 1
},
dataType: 'html',
success: function(data) {
... ...