Authored by 郭成尧

search-brand-list

@@ -216,13 +216,13 @@ const brand = (req, res, next) => { @@ -216,13 +216,13 @@ const brand = (req, res, next) => {
216 216
217 // 从搜索页过来的,显示搜索框, 和进入品牌引导信息 或者品牌关联多店铺 217 // 从搜索页过来的,显示搜索框, 和进入品牌引导信息 或者品牌关联多店铺
218 if (req.query.from === 'search' || brandShop.length > 0) { 218 if (req.query.from === 'search' || brandShop.length > 0) {
219 - params = {  
220 - brandWay: brandShop ? brandShop : brandLogo, 219 + params = _.assign({
  220 + brandWay: _.isEmpty(brandShop) ? brandLogo : brandShop,
221 search: { 221 search: {
222 default: req.query.query, 222 default: req.query.query,
223 url: helpers.urlFormat('', null, 'search') 223 url: helpers.urlFormat('', null, 'search')
224 } 224 }
225 - }; 225 + }, params);
226 } else if (brandId !== 0) { // 品牌一览过来的展示品牌介绍和LOGO 226 } else if (brandId !== 0) { // 品牌一览过来的展示品牌介绍和LOGO
227 return Promise.all([listModel.getBrandIntro(brandId, uid), listModel.getBrandBanner(brandId)]).then((resData) => { //eslint-disable-line 227 return Promise.all([listModel.getBrandIntro(brandId, uid), listModel.getBrandBanner(brandId)]).then((resData) => { //eslint-disable-line
228 title = resData[0].title; 228 title = resData[0].title;
@@ -647,10 +647,10 @@ const getBrandLogoByDomain = (domain) => { @@ -647,10 +647,10 @@ const getBrandLogoByDomain = (domain) => {
647 647
648 return { 648 return {
649 id: formatData.id, 649 id: formatData.id,
650 - url: helpers.urlFormat('', null, formatData.brandDomain),  
651 - thumb: helpers.image(formatData.brandIco, 75, 40), 650 + url: helpers.urlFormat('', null, formatData.brand_domain),
  651 + thumb: helpers.image(formatData.brand_ico, 75, 40),
652 name: formatData.brand_name, 652 name: formatData.brand_name,
653 - shopId: formatData.shop_id ? formatData.shop_id : 0, // 店铺id 653 + shopId: formatData.id ? formatData.id : 0, // 店铺id
654 type: formatData.type ? formatData.type : 0 654 type: formatData.type ? formatData.type : 0
655 }; 655 };
656 } else { 656 } else {
@@ -672,10 +672,10 @@ const getBrandShops = (brandId) => { @@ -672,10 +672,10 @@ const getBrandShops = (brandId) => {
672 code: 200, 672 code: 200,
673 cache: true 673 cache: true
674 }).then(result => { 674 }).then(result => {
675 - if (result.data) { 675 + if (_.isArray(result.data)) {
676 return _processBrandShops(result.data); 676 return _processBrandShops(result.data);
677 } else { 677 } else {
678 - return {}; 678 + return [];
679 } 679 }
680 }); 680 });
681 }; 681 };