...
|
...
|
@@ -11,7 +11,9 @@ const _ = require('lodash'); |
|
|
const logger = global.yoho.logger;
|
|
|
const api = global.yoho.API;
|
|
|
const cache = require('memory-cache');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
// const listModel = require('./list');
|
|
|
|
|
|
/**
|
|
|
* 封面图
|
...
|
...
|
@@ -118,10 +120,12 @@ const _searchGoods = (params) => { |
|
|
|
|
|
if (params.shop_id && !params.productPool) {
|
|
|
method = 'app.search.li';
|
|
|
} else if (params.brand && !params.productPool) {
|
|
|
method = 'app.search.brand';
|
|
|
}
|
|
|
|
|
|
// else if (params.brand && !params.productPool) {
|
|
|
// method = 'app.search.brand';
|
|
|
// }
|
|
|
|
|
|
if (params.channel) {
|
|
|
params.yh_channel = searchProcess.getChannelType(params.channel);
|
|
|
delete params.channel;
|
...
|
...
|
@@ -188,6 +192,41 @@ const _searchGoods = (params) => { |
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取店铺列表
|
|
|
*/
|
|
|
const _processBrandShops = (list) => {
|
|
|
let formatDat = [];
|
|
|
|
|
|
_.forEach(list, item => {
|
|
|
if (item.shop_type === 'yoho_shop') {
|
|
|
formatDat.push({
|
|
|
url: helpers.urlFormat('/product/index/brand/', {
|
|
|
shop_id: item.shop_id
|
|
|
}),
|
|
|
thumb: helpers.image(item.shop_logo, 75, 40),
|
|
|
name: item.shop_name,
|
|
|
shopId: item.shop_id
|
|
|
});
|
|
|
} else if (item.shop_type === 'tbl_brand') {
|
|
|
formatDat.push({
|
|
|
url: helpers.urlFormat('/product/global/list/', {
|
|
|
brand: item.global_brand_id
|
|
|
}),
|
|
|
thumb: helpers.image(item.brand_ico, 75, 40),
|
|
|
name: item.brand_name,
|
|
|
brandId: item.global_brand_id
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
if (formatDat.length > 2) {
|
|
|
formatDat.moreShop = true;
|
|
|
}
|
|
|
|
|
|
return formatDat;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取商品数据
|
|
|
*/
|
|
|
const getSearchData = (params) => {
|
...
|
...
|
@@ -197,6 +236,11 @@ const getSearchData = (params) => { |
|
|
let newList = {};
|
|
|
let suggestion = {};
|
|
|
|
|
|
|
|
|
if (result.data.shopList && result.data.shopList.length !== 0) {
|
|
|
newList.brandWay = _processBrandShops(result.data.shopList);
|
|
|
}
|
|
|
|
|
|
newList.list = productProcess.processProductList(result.data.product_list || [], {
|
|
|
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
|
|
|
gender: _coverChannel[params.coverChannel]
|
...
|
...
|
|