Authored by 刘传洋

search old router

... ... @@ -44,3 +44,31 @@ exports.suggest = (req, res, next) => {
}).catch(next);
};
exports.suggest4Old = (req, res, next) => {
search.getSuggest(Object.assign({}, req.query, { keyword: req.query.query })).then(result => {
let dest = {
code: 200,
message: 'suggest'
};
let data= [];
if(result) {
for(let it of result) {
let item = `<li>`+
`<a style="display: block;" href="${it.href}" class="clearfix clear search-item" title="${it.keyword}" act="${it.href}">`+
`<span class="searchvalue" >${it.keyword}</span><span class="valuenum">约${it.count}个商品</span>`+
`</a>`+
`</li>`;
data.push(item);
}
}
dest.data = data;
res.send(req.query.callback + '(' + JSON.stringify(dest) + ')');
}).catch(next);
}
... ...
... ... @@ -65,6 +65,8 @@ router.get('/search/index', search.index);
// 搜索提示
router.get('/search/suggest', search.suggest);
router.get('/api/suggest', search.suggest4Old);
// 商品分类列表页
router.get('/list/index', list.index);
... ...