Authored by 周少峰

search from

... ... @@ -76,7 +76,7 @@ const getListData = (params, channel) => {
let apiMethod = [
headerModel.requestHeaderData(channel),
searchApi.getSortList(Object.assign({}, {msort: '', misort: ''})),
searchApi.getProductList(searchParams)
searchApi.getProductList(searchParams, 'categoryList')
];
// 搜索分类介绍和广告
... ... @@ -290,7 +290,7 @@ const getBrandData = (params, extra, channel) => {
let apiMethod = [
headerModel.requestHeaderData(channel),
searchApi.getSortList(queryBase),
searchApi.getProductList(Object.assign(searchParams, queryBase))
searchApi.getProductList(Object.assign(searchParams, queryBase), 'brand')
];
if (queryBase.brand) {
... ... @@ -588,7 +588,7 @@ const getShopData = (shopId, channel, params, shopInfo) => {
searchApi.getShopDecorator(shopId), // 店铺装修数据
searchApi.getProductList(Object.assign({
shop_id: shopId
}, params)), // 搜索店铺商品
}, params), 'shop'), // 搜索店铺商品
searchApi.getShopBrands(shopId), // 店铺品牌数据
shopApi.shopCouponListAsync(shopId) // 店铺优惠券数据
]).then(result => {
... ... @@ -647,7 +647,7 @@ const getShopData = (shopId, channel, params, shopInfo) => {
searchApi.getProductList({
viewNum: sknList.length,
query: _.join(_.uniq(sknList), ',')
})
}, 'shop')
];
if (result[3].code === 200 && result[3].data) {
... ... @@ -757,7 +757,7 @@ const getShopGoodsData = (shopId, channel, params) => {
return Promise.all([
searchApi.getProductList(Object.assign({
shop_id: shopId
}, params)), // 搜索店铺商品
}, params), 'shop'), // 搜索店铺商品
searchApi.getSortList({shop_id: shopId}) // 根据店铺id获取分类
]).then(result => {
// 获取商品数据和顶部筛选条件
... ... @@ -793,14 +793,14 @@ const getShopListData = (channel, params, uid) => {
searchApi.getShopDecorator(shopId), // 店铺装修数据
searchApi.getShopInfo(shopId, uid), // 店铺介绍
searchApi.getProductList(Object.assign({shop_id: shopId}, params,
{limit: (params.limit || 60) - 1})), // 搜索店铺商品
{limit: (params.limit || 60) - 1}), 'shop'), // 搜索店铺商品
searchApi.getSortList({shop_id: shopId}) // 店铺分类
];
if (_.has(params, 'query')) {
// 如果有店内搜索,则并行查询店铺所有商品,搜索不到商品则显示所有商品
apiArr.push(searchApi.getProductList(Object.assign({shop_id: shopId},
params, {query: ''}))); // 搜索店铺所有商品
params, {query: ''}), 'shop')); // 搜索店铺所有商品
}
... ...
... ... @@ -554,7 +554,7 @@ exports.getSaleSpecialData = (id, params, channel) => {
}
// 搜索sale活动商品
apiList.push(searchApi.getProductList(condition));
apiList.push(searchApi.getProductList(condition, 'promotion'));
}
return Promise.all(apiList).then(result => {
... ...
... ... @@ -94,7 +94,7 @@ const setSearchData = (result, params, channel) => {
finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.search, 'goods'))};
}
return finalResult;
}
};
/**
* 转换价格
... ... @@ -135,7 +135,7 @@ exports.getSearchData = (params, channel) => {
let apiMethod = [
headerModel.requestHeaderData(channel),
searchApi.getSortList(Object.assign({}, searchParams, {msort: '', misort: '', sort: ''})),
searchApi.getProductList(searchParams),
searchApi.getProductList(searchParams, 'fuzzySearch'),
searchApi.getShopList(params)
];
... ... @@ -144,10 +144,10 @@ exports.getSearchData = (params, channel) => {
return searchApi.getSortList(Object.assign({}, searchParams, {msort: '',
query: _.get(result, '[2]data.suggestion.terms_suggestion[0]', ''),
misort: '', sort: ''})).then(subRes => {
result[1] = subRes;
result[1] = subRes;
return setSearchData(result, params, channel);
});
return setSearchData(result, params, channel);
});
}
return setSearchData(result, params, channel);
... ... @@ -294,8 +294,8 @@ exports.getSearchLessProduct = (channelNum, uid, udid, page) => {
img: it.default_images ? helpers.image(it.default_images, 180, 240) : '',
alt: it.product_name,
price: '¥' + transPrice(it.sales_price),
marketPrice: transPrice(it.market_price) === transPrice(it.sales_price)
? false : ('¥' + transPrice(it.market_price))
marketPrice: transPrice(it.market_price) === transPrice(it.sales_price) ?
false : ('¥' + transPrice(it.market_price))
};
let firstGoods = it.goods_list && it.goods_list[0];
... ...