|
@@ -44,3 +44,31 @@ exports.suggest = (req, res, next) => { |
|
@@ -44,3 +44,31 @@ exports.suggest = (req, res, next) => { |
44
|
}).catch(next);
|
44
|
}).catch(next);
|
45
|
};
|
45
|
};
|
46
|
|
46
|
|
|
|
47
|
+exports.suggest4Old = (req, res, next) => {
|
|
|
48
|
+ search.getSuggest(Object.assign({}, req.query, { keyword: req.query.query })).then(result => {
|
|
|
49
|
+ let dest = {
|
|
|
50
|
+ code: 200,
|
|
|
51
|
+ message: 'suggest'
|
|
|
52
|
+ };
|
|
|
53
|
+
|
|
|
54
|
+ let data= [];
|
|
|
55
|
+
|
|
|
56
|
+ if(result) {
|
|
|
57
|
+ for(let it of result) {
|
|
|
58
|
+
|
|
|
59
|
+ let item = `<li>`+
|
|
|
60
|
+ `<a style="display: block;" href="${it.href}" class="clearfix clear search-item" title="${it.keyword}" act="${it.href}">`+
|
|
|
61
|
+ `<span class="searchvalue" >${it.keyword}</span><span class="valuenum">约${it.count}个商品</span>`+
|
|
|
62
|
+ `</a>`+
|
|
|
63
|
+ `</li>`;
|
|
|
64
|
+
|
|
|
65
|
+ data.push(item);
|
|
|
66
|
+ }
|
|
|
67
|
+ }
|
|
|
68
|
+
|
|
|
69
|
+ dest.data = data;
|
|
|
70
|
+ res.send(req.query.callback + '(' + JSON.stringify(dest) + ')');
|
|
|
71
|
+
|
|
|
72
|
+ }).catch(next);
|
|
|
73
|
+}
|
|
|
74
|
+ |