...
|
...
|
@@ -12,6 +12,7 @@ const searchModel = require(`${mRoot}/search`); |
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const searchProcess = require(`${utils}/search-process`);
|
|
|
const stringCode = require(`${utils}/string-code`);
|
|
|
|
|
|
/**
|
|
|
* 搜索落地页
|
...
|
...
|
@@ -274,10 +275,43 @@ let filter = (req, res, next) => { |
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
// 关键词页
|
|
|
const keyword = (req, res, next) => {
|
|
|
let queryKey = stringCode.hexToUtf8(`${req.params.query}`);
|
|
|
let params = {
|
|
|
isSearch: true, // 搜索列表将最新改成默认的标识
|
|
|
cartUrl: helpers.urlFormat('/cart/index/index'),
|
|
|
query: queryKey
|
|
|
};
|
|
|
|
|
|
params.isApp = req.yoho.isApp;
|
|
|
params.physical_channel = req.yoho.channel && searchProcess.getChannelType(req.yoho.channel);
|
|
|
|
|
|
// 唤起 APP 的路径
|
|
|
res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":${JSON.stringify(params)}}`;
|
|
|
|
|
|
return searchModel.getSearchKeywordData(params, req.user.uid).then(result => {
|
|
|
res.render('search/list', {
|
|
|
_noLazy: true,
|
|
|
module: 'product',
|
|
|
page: 'search-list',
|
|
|
pageHeader: headerModel.setNav({
|
|
|
navTitle: params.query
|
|
|
}),
|
|
|
title: params.query,
|
|
|
goodList: params,
|
|
|
firstPageGoods: result || [],
|
|
|
fuzzyWord: result.fuzzyWord,
|
|
|
pageFooter: true
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
list,
|
|
|
filter,
|
|
|
search,
|
|
|
index,
|
|
|
fuzzyDatas
|
|
|
fuzzyDatas,
|
|
|
keyword
|
|
|
}; |
...
|
...
|
|