Authored by zhangxiaoru

搜索接口调整

@@ -155,8 +155,8 @@ const index = (req, res, next) => { @@ -155,8 +155,8 @@ const index = (req, res, next) => {
155 search: { 155 search: {
156 defaultTerms: (result && result.hotTerms && result.hotTerms.defaultTerms && result.hotTerms.defaultTerms.length !== 0) ? result.hotTerms.defaultTerms[0].content : '', 156 defaultTerms: (result && result.hotTerms && result.hotTerms.defaultTerms && result.hotTerms.defaultTerms.length !== 0) ? result.hotTerms.defaultTerms[0].content : '',
157 url: helpers.urlFormat('', null, 'search'), 157 url: helpers.urlFormat('', null, 'search'),
158 - hotTerms: result.hotTerms.hotTerms,  
159 - wantTerms: result.wantTerms.guessTerms 158 + hotTerms: result.hotTerms,
  159 + wantTerms: result.guessTerms
160 } 160 }
161 161
162 }); 162 });
@@ -259,34 +259,16 @@ const getAllBrandNames = () => { @@ -259,34 +259,16 @@ const getAllBrandNames = () => {
259 }; 259 };
260 260
261 /** 261 /**
262 - * 获取猜你想找  
263 - **/  
264 -const getWantSearch = (uid) => { 262 + * 搜索主页
  263 + */
  264 +const getSearchIndex = (uid) => {
265 return api.get('', { 265 return api.get('', {
266 - method: 'app.search.getSomeTerms', 266 + method: 'app.search.getTerms',
267 uid: uid 267 uid: uid
268 }, { 268 }, {
269 cache: true 269 cache: true
270 }).then((result) => { 270 }).then((result) => {
271 if (result && result.code === 200) { 271 if (result && result.code === 200) {
272 - return result.data;  
273 - } else {  
274 - logger.error('Hot Search return code is not 200');  
275 - return {};  
276 - }  
277 - });  
278 -};  
279 -  
280 -/**  
281 - * 获取热门搜索  
282 - **/  
283 -const getHotSearch = () => {  
284 - return api.get('', {  
285 - method: 'app.search.getTerms'  
286 - }, {  
287 - cache: true  
288 - }).then((result) => {  
289 - if (result && result.code === 200) {  
290 if (result.data.hotTerms && result.data.hotTerms.length > 10) { 272 if (result.data.hotTerms && result.data.hotTerms.length > 10) {
291 result.data.hotTerms = result.data.hotTerms.slice(0, 10); 273 result.data.hotTerms = result.data.hotTerms.slice(0, 10);
292 } 274 }
@@ -299,18 +281,6 @@ const getHotSearch = () => { @@ -299,18 +281,6 @@ const getHotSearch = () => {
299 }; 281 };
300 282
301 /** 283 /**
302 - * 搜索主页  
303 - */  
304 -const getSearchIndex = (uid) => {  
305 - return Promise.all([getHotSearch(), getWantSearch(uid)]).then((result) => {  
306 - return {  
307 - hotTerms: result[0],  
308 - wantTerms: result[1]  
309 - };  
310 - });  
311 -};  
312 -  
313 -/**  
314 * 获取联想词 284 * 获取联想词
315 * @param params 285 * @param params
316 * @returns {*|Promise.<TResult>} 286 * @returns {*|Promise.<TResult>}