...
|
...
|
@@ -9,11 +9,9 @@ const helpers = global.yoho.helpers; |
|
|
const formaData = (data, gender) => {
|
|
|
let build = [];
|
|
|
|
|
|
// console.log(data)
|
|
|
_.forEach(data, function(val) {
|
|
|
// 多张图
|
|
|
if (val.data[1]) {
|
|
|
|
|
|
let imgs = [];
|
|
|
|
|
|
_.forEach(val.data, function(list) {
|
...
|
...
|
@@ -34,7 +32,7 @@ const formaData = (data, gender) => { |
|
|
}
|
|
|
|
|
|
// 单张图
|
|
|
if (val.data[0]) {
|
|
|
if (val.data[0] && !val.data[1]) {
|
|
|
_.forEach(val.data, function(list) {
|
|
|
build.push({
|
|
|
url: '/guang/plustar/brandinfo?id=' + val.id + '&gender=' + gender,
|
...
|
...
|
@@ -48,15 +46,19 @@ const formaData = (data, gender) => { |
|
|
return build;
|
|
|
};
|
|
|
|
|
|
const getContentData = (gender, type, channel, isRecommend) => {
|
|
|
let param = {
|
|
|
gender: gender,
|
|
|
brand_type: type,
|
|
|
yh_channel: channel
|
|
|
};
|
|
|
|
|
|
const getContentData = (gender, type) => {
|
|
|
if (isRecommend) {
|
|
|
param.is_recommend = isRecommend;
|
|
|
}
|
|
|
|
|
|
return serviceAPI.get('guang/api/v3/plustar/getlist', {
|
|
|
gender: gender,
|
|
|
brand_type: type
|
|
|
}).then((result) => {
|
|
|
return serviceAPI.get('guang/api/v3/plustar/getlist', param).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
// console.log(result)
|
|
|
return formaData(result.data.data.list[0].data, gender);
|
|
|
} else {
|
|
|
logger.error('列表 list data return code is not 200');
|
...
|
...
|
@@ -74,6 +76,15 @@ const getListData = (gender, recom, all) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const getBrandsData = (gender, starBrand, originalBrand, channel, isRecommend) => {
|
|
|
return Promise.all([getContentData(gender, starBrand, isRecommend, channel), getContentData(gender, originalBrand, isRecommend, channel)]).then((result) => {
|
|
|
return {
|
|
|
star: result[0],
|
|
|
plus: result[1]
|
|
|
};
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 新品到着
|
|
|
const getNewProduct = (brandId, gender, url) => {
|
|
|
|
...
|
...
|
@@ -97,7 +108,6 @@ const getNewProduct = (brandId, gender, url) => { |
|
|
let obj = {};
|
|
|
let price;
|
|
|
|
|
|
// console.log(list)
|
|
|
if (index <= 5) {
|
|
|
let tag = [];
|
|
|
|
...
|
...
|
@@ -270,5 +280,6 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { |
|
|
module.exports = {
|
|
|
getListData,
|
|
|
getContentData,
|
|
|
getDetailData
|
|
|
getDetailData,
|
|
|
getBrandsData
|
|
|
}; |
...
|
...
|
|