Authored by OF1706

less sum

@@ -115,8 +115,6 @@ exports.serachFilterBrands = (req, res, next) => { @@ -115,8 +115,6 @@ exports.serachFilterBrands = (req, res, next) => {
115 **/ 115 **/
116 exports.searchLessRecommend = (req, res, next) => { 116 exports.searchLessRecommend = (req, res, next) => {
117 117
118 -  
119 - console.log(req.query.page);  
120 return co(function * () { 118 return co(function * () {
121 119
122 let channel = req.yoho.channel; 120 let channel = req.yoho.channel;
@@ -130,7 +128,6 @@ exports.searchLessRecommend = (req, res, next) => { @@ -130,7 +128,6 @@ exports.searchLessRecommend = (req, res, next) => {
130 128
131 let ret = yield search.getSearchLessProduct(channel, uid, udid, page); 129 let ret = yield search.getSearchLessProduct(channel, uid, udid, page);
132 130
133 -  
134 return res.send(ret); 131 return res.send(ret);
135 132
136 })().catch(next); 133 })().catch(next);
@@ -114,14 +114,15 @@ exports.getSearchData = (params, channel) => { @@ -114,14 +114,15 @@ exports.getSearchData = (params, channel) => {
114 shopEntry: result[3], 114 shopEntry: result[3],
115 name: params.query, 115 name: params.query,
116 suggest: termsSuggestion ? termsSuggestion.join(',').split(',').splice(0, 3) : false, 116 suggest: termsSuggestion ? termsSuggestion.join(',').split(',').splice(0, 3) : false,
117 - changedQuery: result[2].data.isChangedQuery, 117 + changedQuery: result[2].data.isChangedQuery == 'Y',
118 suggestFirst: finalResult.search.suggestFirst, 118 suggestFirst: finalResult.search.suggestFirst,
119 suggestSecond: finalResult.search.suggestSecond 119 suggestSecond: finalResult.search.suggestSecond
120 }); 120 });
121 121
122 - if (finalResult.search.changedQuery === 'Y') { 122 + if (finalResult.search.changedQuery) {
  123 +
123 finalResult.search.suggestFirst = finalResult.search.suggest[0]; 124 finalResult.search.suggestFirst = finalResult.search.suggest[0];
124 - finalResult.search.suggestSecond = _.reverse(_.slice(_.reverse(finalResult.search.suggest))); 125 + finalResult.search.suggestSecond = _.slice(termsSuggestion, 1, termsSuggestion.length).splice(0,3);
125 } 126 }
126 127
127 finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.search, 'goods'))}; 128 finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.search, 'goods'))};
@@ -236,11 +237,6 @@ exports.getSearchLessProduct = (channel, uid, udid, page) => { @@ -236,11 +237,6 @@ exports.getSearchLessProduct = (channel, uid, udid, page) => {
236 } 237 }
237 }; 238 };
238 239
239 - console.log('**************');  
240 - console.log(page);  
241 - console.log('**************');  
242 - console.log(_.isNumber(page));  
243 - console.log(typeof page);  
244 let channelNum = 1; 240 let channelNum = 1;
245 241
246 if (!_.isNumber(page)) { 242 if (!_.isNumber(page)) {
@@ -57,15 +57,17 @@ @@ -57,15 +57,17 @@
57 </div> 57 </div>
58 <div class="list-right pull-right"> 58 <div class="list-right pull-right">
59 59
60 - {{#if_cond goods.length '>' 20 }} 60 + {{#if_cond goods.length '<' 20 }}
61 61
62 {{#if suggest}} 62 {{#if suggest}}
  63 + {{#unless changedQuery}}
  64 +
63 <div class="search-suggest-less"> 65 <div class="search-suggest-less">
64 "<em>{{name}}</em>"&nbsp;搜索结果太少了,试试{{#suggest}}&nbsp;"<a href="/?query={{.}}">{{.}}</a>"&nbsp;{{/suggest}}关键词搜索 66 "<em>{{name}}</em>"&nbsp;搜索结果太少了,试试{{#suggest}}&nbsp;"<a href="/?query={{.}}">{{.}}</a>"&nbsp;{{/suggest}}关键词搜索
65 </div> 67 </div>
  68 + {{/unless}}
66 {{/if}} 69 {{/if}}
67 70
68 -  
69 {{#if changedQuery}} 71 {{#if changedQuery}}
70 <div class="search-suggest-less"> 72 <div class="search-suggest-less">
71 没有找到&nbsp;"<em>{{name}}</em>"&nbsp;相关的商品, 73 没有找到&nbsp;"<em>{{name}}</em>"&nbsp;相关的商品,
@@ -74,7 +76,6 @@ @@ -74,7 +76,6 @@
74 76
75 {{/if}} 77 {{/if}}
76 78
77 -  
78 {{/if_cond}} 79 {{/if_cond}}
79 80
80 {{> list/top-coupon}} 81 {{> list/top-coupon}}
@@ -100,6 +101,13 @@ @@ -100,6 +101,13 @@
100 {{> product/standard-content}} 101 {{> product/standard-content}}
101 102
102 {{#if_cond goods.length '<' 20 }} 103 {{#if_cond goods.length '<' 20 }}
  104 +
  105 + <div>
  106 + <textarea class="lazy-load-object-2" style="visibility: hidden;">
  107 + <script>getSearchRecommend();</script>
  108 + </textarea>
  109 + </div>
  110 +
103 <div class="bottom-tab-line"> 111 <div class="bottom-tab-line">
104 <span class="bottom-title" data-type="recommend" data-role="recommend-tab">你可能喜欢</span> 112 <span class="bottom-title" data-type="recommend" data-role="recommend-tab">你可能喜欢</span>
105 </div> 113 </div>
@@ -107,13 +115,7 @@ @@ -107,13 +115,7 @@
107 <div class="goods-slide"> 115 <div class="goods-slide">
108 <div data-role="recommend-slide" class="slide-panel"></div> 116 <div data-role="recommend-slide" class="slide-panel"></div>
109 </div> 117 </div>
110 - <div>  
111 - <div class="lazy-load-object-2">  
112 - <textarea class="latest-walk-datalazyload" style="visibility: hidden;">  
113 - <script>getSearchRecommend();</script>  
114 - </textarea>  
115 - </div>  
116 - </div> 118 +
117 {{/if_cond}} 119 {{/if_cond}}
118 120
119 {{> product/latest-walk}} 121 {{> product/latest-walk}}
@@ -24,10 +24,8 @@ @@ -24,10 +24,8 @@
24 <div data-role="recommend-slide" class="slide-panel"></div> 24 <div data-role="recommend-slide" class="slide-panel"></div>
25 </div> 25 </div>
26 <div> 26 <div>
27 - <div class="lazy-load-object-2">  
28 - <textarea class="latest-walk-datalazyload" style="visibility: hidden;">  
29 - <script>getSearchRecommend();</script>  
30 - </textarea>  
31 - </div> 27 + <textarea class="lazy-load-object-2" style="visibility: hidden;">
  28 + <script>getSearchRecommend();</script>
  29 + </textarea>
32 </div> 30 </div>
33 </div> 31 </div>