Authored by 陈峰

Merge branch 'hotfix/searchHistory' into 'gray'

Hotfix/search history



See merge request !238
@@ -104,7 +104,7 @@ module.exports = class favorite extends global.yoho.BaseModel { @@ -104,7 +104,7 @@ module.exports = class favorite extends global.yoho.BaseModel {
104 url: '/home/favorite/reduction' 104 url: '/home/favorite/reduction'
105 }; 105 };
106 106
107 - if (data.data.num) { 107 + if (data.data && data.data.num) {
108 result.count = +data.data.num; 108 result.count = +data.data.num;
109 result.phone = data.data.mobile; 109 result.phone = data.data.mobile;
110 } 110 }
@@ -155,6 +155,7 @@ const searchHistory = (req, res) => { @@ -155,6 +155,7 @@ const searchHistory = (req, res) => {
155 if (q) { 155 if (q) {
156 history.unshift(q); 156 history.unshift(q);
157 res.cookie('_History', _.take(history, 9).join(','), { 157 res.cookie('_History', _.take(history, 9).join(','), {
  158 + path: '/',
158 domain: config.cookieDomain, 159 domain: config.cookieDomain,
159 maxAge: 60 * 60 * 24 * 1000 * 30 // 一月 160 maxAge: 60 * 60 * 24 * 1000 * 30 // 一月
160 }); 161 });
@@ -514,7 +514,7 @@ function getSalebreakingYardsData(params, channel) { @@ -514,7 +514,7 @@ function getSalebreakingYardsData(params, channel) {
514 // 处理筛选条件数据 514 // 处理筛选条件数据
515 if (subResult[0].code === 200) { 515 if (subResult[0].code === 200) {
516 finalResult.leftContent = 516 finalResult.leftContent =
517 - publicHandler.handleSaleSortData(subResult[0].data.filter.group_sort, 517 + publicHandler.handleSaleSortData(_.get(subResult[0], 'data.filter.group_sort', []),
518 params, '', baseUrl); 518 params, '', baseUrl);
519 } 519 }
520 520
@@ -1818,7 +1818,7 @@ exports.handleSuggestData = (origin, query) => { @@ -1818,7 +1818,7 @@ exports.handleSuggestData = (origin, query) => {
1818 }]; 1818 }];
1819 1819
1820 _.forEach(origin, value => { 1820 _.forEach(origin, value => {
1821 - if (query === value.keyword || value.keyword.length <= 2) { 1821 + if (!value.keyword || query === value.keyword || value.keyword.length <= 2) {
1822 return; 1822 return;
1823 } 1823 }
1824 1824
@@ -966,7 +966,10 @@ function searchSuggestHistory() { @@ -966,7 +966,10 @@ function searchSuggestHistory() {
966 966
967 // 历史记录清空 967 // 历史记录清空
968 $('.search-suggest-title .search-del').click(function() { 968 $('.search-suggest-title .search-del').click(function() {
969 - window.setCookie('_History', '', {domain: '.yohobuy.com'}); 969 + window.setCookie('_History', '', {
  970 + domain: '.yohobuy.com',
  971 + path: '/'
  972 + });
970 $searchHistory.empty(); 973 $searchHistory.empty();
971 $searchKey.attr('alt', true); 974 $searchKey.attr('alt', true);
972 return false; 975 return false;
1 User-Agent: * 1 User-Agent: *
2 Disallow: /passport/ 2 Disallow: /passport/
3 -Disallow: signin.html  
4 -Disallow: reg.html  
5 -Disallow: /cart/ 3 +Disallow: /signin.html
  4 +Disallow: /reg.html
  5 +Disallow: /cart/
6 Disallow: /home/ 6 Disallow: /home/
7 Disallow: /shopping/ 7 Disallow: /shopping/
8 Disallow: /service/ 8 Disallow: /service/
9 Disallow: /settled/ 9 Disallow: /settled/
10 -Disallow: /3party/  
  10 +Disallow: /3party/
  11 +Disallow: /coupon/
  12 +Disallow: /japanKorean/
  13 +Disallow: /guang/tags/
  14 +Disallow: /help/
  15 +Disallow: /search/
  16 +Disallow: /*?*