...
|
...
|
@@ -4,6 +4,49 @@ const serviceAPI = global.yoho.ServiceAPI; |
|
|
const _ = require('lodash');
|
|
|
const productProcess = require('../../../utils/product-process');
|
|
|
|
|
|
const formaData = (data, gender) => {
|
|
|
let build = [];
|
|
|
//console.log(data)
|
|
|
_.forEach(data, function(val) {
|
|
|
//多张图
|
|
|
if(val.data[1]) {
|
|
|
|
|
|
let imgs = [];
|
|
|
|
|
|
_.forEach(val.data, function(list) {
|
|
|
let obj = {};
|
|
|
|
|
|
obj = _.assign(obj, {
|
|
|
url: '/plustar/brandinfo?id=' + val.id + '&gender=' + gender,
|
|
|
img: list.src,
|
|
|
deps: val.brand_title
|
|
|
});
|
|
|
|
|
|
imgs.push(obj);
|
|
|
})
|
|
|
|
|
|
build.push({
|
|
|
imgs: imgs
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
//单张图
|
|
|
if(val.data[0]) {
|
|
|
_.forEach(val.data, function(list) {
|
|
|
build.push({
|
|
|
url: '/plustar/brandinfo?id=' + val.id + '&gender=' + gender,
|
|
|
img: list.src,
|
|
|
deps: val.brand_title
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
|
|
|
return build;
|
|
|
}
|
|
|
|
|
|
|
|
|
const getContentData = (gender, type) => {
|
|
|
|
...
|
...
|
@@ -12,8 +55,8 @@ const getContentData = (gender, type) => { |
|
|
brand_type: type
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
// console.log(result)
|
|
|
return result;
|
|
|
//console.log(result)
|
|
|
return formaData(result.data.data.list[0].data, gender);
|
|
|
} else {
|
|
|
logger.error('列表 list data return code is not 200');
|
|
|
return {};
|
...
|
...
|
@@ -21,6 +64,8 @@ const getContentData = (gender, type) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const getListData = (gender, recom, all) => {
|
|
|
return Promise.all([getContentData(gender, recom), getContentData(gender, all)]).then((result) => {
|
|
|
return {
|
...
|
...
|
|