Authored by OF1706

searchTerms sum2

@@ -193,11 +193,8 @@ exports.getBrands4Filter = (params) => { @@ -193,11 +193,8 @@ exports.getBrands4Filter = (params) => {
193 * @return {[type]} [description] 193 * @return {[type]} [description]
194 */ 194 */
195 exports.getSearchRecommend = (channel, params) => { 195 exports.getSearchRecommend = (channel, params) => {
196 - return searchApi.getSearchRecommend(channel, params).then(result => {  
197 196
198 - if (result.code === 200) {  
199 -  
200 - let channelNum = 1; // -eslint-disable-line 197 + let channelNum = 1;
201 198
202 switch (channel) { 199 switch (channel) {
203 case 'boys': 200 case 'boys':
@@ -207,8 +204,6 @@ exports.getSearchRecommend = (channel, params) => { @@ -207,8 +204,6 @@ exports.getSearchRecommend = (channel, params) => {
207 channelNum = 2; 204 channelNum = 2;
208 break; 205 break;
209 case 'kids': 206 case 'kids':
210 - channelNum = 3;  
211 - break;  
212 case 'lifestyle': 207 case 'lifestyle':
213 channelNum = 3; 208 channelNum = 3;
214 break; 209 break;
@@ -216,6 +211,10 @@ exports.getSearchRecommend = (channel, params) => { @@ -216,6 +211,10 @@ exports.getSearchRecommend = (channel, params) => {
216 break; 211 break;
217 } 212 }
218 213
  214 + return searchApi.getSearchRecommend(channelNum, params).then(result => {
  215 +
  216 + if (result.code === 200) {
  217 +
219 let resData = { 218 let resData = {
220 hotTerms: [] 219 hotTerms: []
221 }; 220 };
@@ -934,8 +934,10 @@ $('.search-suggest-history').mouseenter(function() { @@ -934,8 +934,10 @@ $('.search-suggest-history').mouseenter(function() {
934 * 搜索 热门搜索和默认搜索 api 934 * 搜索 热门搜索和默认搜索 api
935 * @return {[type]} [description] 935 * @return {[type]} [description]
936 */ 936 */
937 -function searchSuggestRecommend(key) { 937 +function searchSuggestRecommend(channel,key) {
  938 +
938 var param = { 939 var param = {
  940 + channel: channel,
939 return_type: 'jsonp', 941 return_type: 'jsonp',
940 keyword: key 942 keyword: key
941 }; 943 };
@@ -944,16 +946,14 @@ function searchSuggestRecommend(key) { @@ -944,16 +946,14 @@ function searchSuggestRecommend(key) {
944 946
945 var searchSuggestRecommendHtml; //eslint-disable-line 947 var searchSuggestRecommendHtml; //eslint-disable-line
946 948
947 - if (jsonData.code === 200) {  
948 - if (jsonData.data && jsonData.data.hotTerms.length) { 949 + if (jsonData.code == 200) {
949 950
950 searchSuggestRecommendHtml = handlebars.compile($searchRecommendHbs.html() || ''); 951 searchSuggestRecommendHtml = handlebars.compile($searchRecommendHbs.html() || '');
951 $searchRecommend.html(searchSuggestRecommendHtml(jsonData)).show(); 952 $searchRecommend.html(searchSuggestRecommendHtml(jsonData)).show();
952 953
953 - } else { 954 + }else{
954 $searchRecommend.hide(); 955 $searchRecommend.hide();
955 } 956 }
956 - }  
957 957
958 }); 958 });
959 } 959 }