Authored by 毕凯

Merge branch 'feature/search' into 'release/6.5'

search-redirect



See merge request !1262
@@ -94,22 +94,6 @@ module.exports = class extends global.yoho.BaseModel { @@ -94,22 +94,6 @@ module.exports = class extends global.yoho.BaseModel {
94 } 94 }
95 95
96 /** 96 /**
97 - * 新的搜索接口处理,替换 _searchGoods  
98 - */  
99 - _queryGoods(params) {  
100 - let paramsForApi = searchProcess.getSearchParamsWithoutMethod(params);  
101 -  
102 - return this.get({  
103 - data: _.assign({  
104 - method: 'app.search.li'  
105 - }, paramsForApi),  
106 - param: {  
107 - cache: true  
108 - }  
109 - });  
110 - }  
111 -  
112 - /**  
113 * 获取店铺列表 97 * 获取店铺列表
114 */ 98 */
115 _processBrandShops(list) { 99 _processBrandShops(list) {
@@ -152,7 +136,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -152,7 +136,7 @@ module.exports = class extends global.yoho.BaseModel {
152 // client_type 全部赋值为h5 过滤掉嵌入APP页面是默认的client_type 136 // client_type 全部赋值为h5 过滤掉嵌入APP页面是默认的client_type
153 params.client_type = 'h5'; 137 params.client_type = 'h5';
154 138
155 - return this._queryGoods(params).then((result) => { 139 + return this.getCategoryGoods(params).then((result) => {
156 if (result && result.code === 200) { 140 if (result && result.code === 200) {
157 let newList = {}; 141 let newList = {};
158 let suggestion = {}; 142 let suggestion = {};
@@ -33,9 +33,9 @@ module.exports = () => { @@ -33,9 +33,9 @@ module.exports = () => {
33 case 'search': // search 33 case 'search': // search
34 // 有查询关键字 34 // 有查询关键字
35 if (_.keys(req.query).length) { 35 if (_.keys(req.query).length) {
36 - return res.redirect(301, listParamsProcess.generatePathUrl(req.query, 'search/list')); 36 + return res.redirect(301, `//m.yohobuy.com/search/list?${querystring.stringify(req.query)}`);
37 } else { 37 } else {
38 - return res.redirect(301, listParamsProcess.generatePathUrl(req.query, 'search')); 38 + return res.redirect(301, '//m.yohobuy.com/search');
39 } 39 }
40 40
41 // 已经废弃,只是对老页面做兼容 --start 41 // 已经废弃,只是对老页面做兼容 --start
@@ -339,6 +339,10 @@ const getSearchParamsWithoutMethod = (params) => { @@ -339,6 +339,10 @@ const getSearchParamsWithoutMethod = (params) => {
339 finalParams.physical_channel = params.physical_channel; 339 finalParams.physical_channel = params.physical_channel;
340 } 340 }
341 341
  342 + finalParams = _.mapValues(finalParams, value => {
  343 + return stringProcess.decodeURIComponent(value);
  344 + });
  345 +
342 return finalParams; 346 return finalParams;
343 }; 347 };
344 348