...
|
...
|
@@ -151,13 +151,14 @@ const _getBrandListOriginData = (channel) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const indexData = (isbrand, gender, code) => {
|
|
|
if (isbrand) {
|
|
|
return Promise.all([_getChannelData(gender), _getResourcesData(code), _getBrandListOriginData(gender)]).then(result => {
|
|
|
const indexData = (gender, brandCode, cateCode) => {
|
|
|
return Promise.all([_getChannelData(gender), _getResourcesData(brandCode), _getBrandListOriginData(gender), _getResourcesData(cateCode)]).then(result => {
|
|
|
let brandList = {};
|
|
|
let list = {};
|
|
|
let categoryData = {};
|
|
|
|
|
|
if (result[0]) {
|
|
|
categoryData.channel = result[0];
|
|
|
list.channel = result[0];
|
|
|
}
|
|
|
|
...
|
...
|
@@ -176,23 +177,62 @@ const indexData = (isbrand, gender, code) => { |
|
|
brandList.indexList = result[2].indexList;
|
|
|
}
|
|
|
|
|
|
if (result[3]) {
|
|
|
_.forEach(result[3], function(data) {
|
|
|
if (data.template_name === 'recommend_content_five') {
|
|
|
categoryData.list = data.data.list;
|
|
|
} else if (data.template_name === 'focus') {
|
|
|
categoryData.focusData = data;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
list.brandList = brandList;
|
|
|
list.categoryData = categoryData;
|
|
|
return list;
|
|
|
});
|
|
|
// return favfavBrand(uid, page, limit).then(result=> {
|
|
|
// if (result.total === 0) {
|
|
|
// result = {nobrandData: 1};
|
|
|
// return Promise.all([_getChannelData(gender), _getResourcesData(code)]).then(result => {
|
|
|
// let categoryData = {};
|
|
|
// let list = {};
|
|
|
|
|
|
// if (result[0]) {
|
|
|
// list.channel = result[0];
|
|
|
// }
|
|
|
|
|
|
// if (result[1]) {
|
|
|
// _.forEach(result[1], function(data) {
|
|
|
// if (data.template_name === 'recommend_content_five') {
|
|
|
// categoryData.list = data.data.list;
|
|
|
// } else if (data.template_name === 'focus') {
|
|
|
// categoryData.focusData = data;
|
|
|
// }
|
|
|
// return result;
|
|
|
// });
|
|
|
} else {
|
|
|
// return favProduct(uid, page, limit).then(result=> {
|
|
|
// if (result.total === 0) {
|
|
|
// result = {noproductData: 1};
|
|
|
// }
|
|
|
// return result;
|
|
|
|
|
|
// list.categoryData = categoryData;
|
|
|
// return list;
|
|
|
// });
|
|
|
|
|
|
//全部分类
|
|
|
// return api.get('', {
|
|
|
// method: 'app.sort.get'
|
|
|
// }, {
|
|
|
// cache: true
|
|
|
// }).then((result) => {
|
|
|
// if (!result.code || result.code !== 200 || !result.data) {
|
|
|
// return [];
|
|
|
// }
|
|
|
|
|
|
// // 统一频道名称
|
|
|
// result.data.boys = result.data.boy;
|
|
|
// result.data.girls = result.data.girl;
|
|
|
// _.unset(result.data, 'boy');
|
|
|
// _.unset(result.data, 'girl');
|
|
|
|
|
|
// return result.data;
|
|
|
// }).then((list) => {
|
|
|
// return _processCateData(list, channel);
|
|
|
// });
|
|
|
}
|
|
|
};
|
|
|
|
|
|
const brandListData = (code, gender) => {
|
...
|
...
|
@@ -220,7 +260,29 @@ const brandListData = (code, gender) => { |
|
|
})
|
|
|
}
|
|
|
|
|
|
const categoryData = (code, gender) => {
|
|
|
|
|
|
return _getResourcesData(code).then(result => {
|
|
|
let categoryData = {};
|
|
|
let list = {};
|
|
|
|
|
|
if (result) {
|
|
|
_.forEach(result, function(data) {
|
|
|
if (data.template_name === 'recommend_content_five') {
|
|
|
categoryData.list = data.data.list;
|
|
|
} else if (data.template_name === 'focus') {
|
|
|
categoryData.focusData = data;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
list.categoryData = categoryData;
|
|
|
return list;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
|
indexData,
|
|
|
brandListData
|
|
|
brandListData,
|
|
|
categoryData
|
|
|
}; |
|
|
\ No newline at end of file |
...
|
...
|
|