...
|
...
|
@@ -14,6 +14,9 @@ const searchHandler = require('./search-handler'); |
|
|
// 搜索分类信息需要的参数
|
|
|
const positionId = 10;
|
|
|
|
|
|
// 获取分类左侧广告id
|
|
|
const sortAdsId = 79;
|
|
|
|
|
|
/**
|
|
|
* 获取商品分类列表数据
|
|
|
*/
|
...
|
...
|
@@ -28,14 +31,13 @@ exports.getListData = (params) => { |
|
|
// 搜索分类介绍和广告
|
|
|
if (params.msort && params.misort) {
|
|
|
let IntroParams = {
|
|
|
position_id: positionId,
|
|
|
max_sort_id: params.msort,
|
|
|
middle_sort_id: params.misort,
|
|
|
gender: params.gender || '1,3'
|
|
|
};
|
|
|
|
|
|
apiMethod.push(searchApi.getSortIntro(IntroParams));
|
|
|
apiMethod.push(searchApi.getSortAds(IntroParams));
|
|
|
apiMethod.push(searchApi.getSortIntro(Object.assign(IntroParams, {position_id: positionId})));
|
|
|
apiMethod.push(searchApi.getSortAds(Object.assign(IntroParams, {position_id: sortAdsId})));
|
|
|
}
|
|
|
|
|
|
return api.all(apiMethod).then(result => {
|
...
|
...
|
@@ -43,12 +45,14 @@ exports.getListData = (params) => { |
|
|
headerData: Object.assign(result[0].headerData, {
|
|
|
header: true
|
|
|
}),
|
|
|
search: {}
|
|
|
list: {
|
|
|
leftContent: {}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// 获取左侧类目数据
|
|
|
if (result[1].code === 200) {
|
|
|
finalResult.search = {
|
|
|
finalResult.list = {
|
|
|
leftContent: searchHandler.handleSortData(result[1].data.sort, params),
|
|
|
pathNav: searchHandler.handlePathNavData(result[1].data.sort, params, 'sort')
|
|
|
};
|
...
|
...
|
@@ -56,7 +60,7 @@ exports.getListData = (params) => { |
|
|
|
|
|
// 获取商品数据和顶部筛选条件
|
|
|
if (result[2].code === 200) {
|
|
|
Object.assign(finalResult.search, {
|
|
|
Object.assign(finalResult.list, {
|
|
|
filters: searchHandler.handleFilterData(result[2].data.filter, params),
|
|
|
opts: searchHandler.handleOptsData(params, result[2].data.total, result[2].data.filter),
|
|
|
totalCount: result[2].data.total,
|
...
|
...
|
@@ -68,12 +72,12 @@ exports.getListData = (params) => { |
|
|
|
|
|
// 分类介绍
|
|
|
if (result[3] && result[3].code === 200) {
|
|
|
finalResult.sortIntro = searchHandler.handleSortIntro(result[3].data);
|
|
|
finalResult.list.sortIntro = searchHandler.handleSortIntro(result[3].data);
|
|
|
}
|
|
|
|
|
|
// 分类广告
|
|
|
if (result[4] && result[4].code === 200) {
|
|
|
finalResult.sortIntro = searchHandler.handleSortAds(result[4].data);
|
|
|
Object.assign(finalResult.list.leftContent, searchHandler.handleSortAds(result[4].data));
|
|
|
}
|
|
|
return finalResult;
|
|
|
});
|
...
|
...
|
|