...
|
...
|
@@ -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);
|
|
|
}
|
|
|
|
...
|
...
|
|