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 {
}
/**
* 新的搜索接口处理,替换 _searchGoods
*/
_queryGoods(params) {
let paramsForApi = searchProcess.getSearchParamsWithoutMethod(params);
return this.get({
data: _.assign({
method: 'app.search.li'
}, paramsForApi),
param: {
cache: true
}
});
}
/**
* 获取店铺列表
*/
_processBrandShops(list) {
... ... @@ -152,7 +136,7 @@ module.exports = class extends global.yoho.BaseModel {
// client_type 全部赋值为h5 过滤掉嵌入APP页面是默认的client_type
params.client_type = 'h5';
return this._queryGoods(params).then((result) => {
return this.getCategoryGoods(params).then((result) => {
if (result && result.code === 200) {
let newList = {};
let suggestion = {};
... ...
... ... @@ -33,9 +33,9 @@ module.exports = () => {
case 'search': // search
// 有查询关键字
if (_.keys(req.query).length) {
return res.redirect(301, listParamsProcess.generatePathUrl(req.query, 'search/list'));
return res.redirect(301, `//m.yohobuy.com/search/list?${querystring.stringify(req.query)}`);
} else {
return res.redirect(301, listParamsProcess.generatePathUrl(req.query, 'search'));
return res.redirect(301, '//m.yohobuy.com/search');
}
// 已经废弃,只是对老页面做兼容 --start
... ...
... ... @@ -339,6 +339,10 @@ const getSearchParamsWithoutMethod = (params) => {
finalParams.physical_channel = params.physical_channel;
}
finalParams = _.mapValues(finalParams, value => {
return stringProcess.decodeURIComponent(value);
});
return finalParams;
};
... ...