Authored by yyq

调整店铺查询参数

... ... @@ -281,7 +281,6 @@ const getBrandData = (params, extra, channel) => {
headerModel.requestHeaderData(channel),
searchApi.getSortList(queryBase),
searchApi.getProductList(Object.assign(searchParams, queryBase))
];
return Promise.all(apiMethod).then(result => {
... ... @@ -596,8 +595,7 @@ const getShopData = (shopId, channel, params, shopInfo) => {
sknList.push(value.productSkn);
});
let shopBrandIds = [], // 店铺的所有品牌id
articleApiMethod = [], // 通过品牌获取相关文章接口
let articleApiMethod = [], // 通过品牌获取相关文章接口
apiMethod = [
searchApi.getProductList({
viewNum: sknList.length,
... ... @@ -607,15 +605,14 @@ const getShopData = (shopId, channel, params, shopInfo) => {
if (result[3].code === 200 && result[3].data) {
_.forEach(result[3].data, value => {
shopBrandIds.push(value.brand_id);
articleApiMethod.push(
searchApi.getArticleByBrand(value.brand_id, 'udid') // 品牌推荐文章
);
});
}
// 根据品牌获取分类 (腾讯云测试没有该接口,暂时不调用分类)
apiMethod.push(searchApi.getSortList({brand: shopBrandIds}));
// 根据店铺id获取分类
apiMethod.push(searchApi.getSortList({shop_id: shopId}));
apiMethod = _.concat(apiMethod, articleApiMethod);
return Promise.all(apiMethod).then(subRes => {
... ... @@ -708,7 +705,7 @@ const getShopGoodsData = (shopId, channel, params) => {
searchApi.getProductList(Object.assign({
shop_id: shopId
}, params)), // 搜索店铺商品
searchApi.getShopBrands(shopId) // 店铺品牌数据
searchApi.getSortList({shop_id: shopId}) // 根据店铺id获取分类
]).then(result => {
// 获取商品数据和顶部筛选条件
if (result[0].code === 200) {
... ... @@ -723,25 +720,14 @@ const getShopGoodsData = (shopId, channel, params) => {
_.set(resData, 'sort.newPage', true); // 启用新的分页导航
}
let shopBrandIds = []; // 店铺的所有品牌id
if (result[1].code === 200) {
let groupSort = _.get(result[1], 'data.sort', []);
if (result[1].code === 200 && result[1].data) {
_.forEach(result[1].data, value => {
shopBrandIds.push(value.brand_id);
});
Object.assign(resData, searchHandler.setShopSort(groupSort, Object.assign({}, params,
{page: 1})), searchHandler.setGenderFilter(params));
}
// 根据品牌获取分类 (腾讯云测试没有该接口,暂时不调用分类)
return searchApi.getSortList({brand: shopBrandIds}).then(subRes => {
if (subRes.code === 200) {
let groupSort = _.get(subRes, 'data.sort', []);
Object.assign(resData, searchHandler.setShopSort(groupSort, Object.assign({}, params,
{page: 1})), searchHandler.setGenderFilter(params));
}
return resData;
});
return resData;
});
};
... ... @@ -754,10 +740,11 @@ const getShopListData = (channel, params, uid) => {
searchApi.getShopDecorator(shopId), // 店铺装修数据
searchApi.getShopInfo(shopId, uid), // 店铺介绍
searchApi.getProductList(Object.assign({shop_id: shopId}, params)), // 搜索店铺商品
searchApi.getShopBrands(shopId) // 店铺品牌数据
searchApi.getSortList({shop_id: shopId}) // 店铺分类
];
if (_.has(params, 'query')) {
// 如果有店内搜索,则并行查询店铺所有商品,搜索不到商品则显示所有商品
apiArr.push(searchApi.getProductList(Object.assign({shop_id: shopId},
params, {query: ''}))); // 搜索店铺所有商品
}
... ... @@ -839,27 +826,15 @@ const getShopListData = (channel, params, uid) => {
}
if (result[4].code === 200) {
let shopBrandIds = []; // 店铺下的所有品牌id数组
_.forEach(_.get(result[4], 'data', []), value => {
shopBrandIds.push(value.brand_id);
});
return searchApi.getSortList({brand: shopBrandIds}).then(subRes => {
if (subRes.code === 200) {
let groupSort = _.get(subRes, 'data.sort', []),
noPageQs = Object.assign({}, params, {page: 1});
let groupSort = _.get(result[4], 'data.sort', []),
noPageQs = Object.assign({}, params, {page: 1});
finalResult.leftContent = searchHandler.handleSortData(groupSort, noPageQs);
if (finalResult.allGoods) {
Object.assign(finalResult.allGoods, searchHandler.setShopSort(groupSort, noPageQs));
}
}
return finalResult;
});
finalResult.leftContent = searchHandler.handleSortData(groupSort, noPageQs);
if (finalResult.allGoods) {
Object.assign(finalResult.allGoods, searchHandler.setShopSort(groupSort, noPageQs));
}
}
finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult, 'goods'))};
... ...