Commit a36d3d52 authored by Hsinli's avatar Hsinli

addd

parent 879f66b0
Pipeline #8734 passed with stage
in 13 seconds
...@@ -46,6 +46,7 @@ class searchHistoryService extends Service { ...@@ -46,6 +46,7 @@ class searchHistoryService extends Service {
let filter = { let filter = {
page: 1, page: 1,
limit: 50, limit: 50,
attributes: [[sequelize.literal('distinct `key_word`'), 'key_word']],
where: { where: {
state: 1, state: 1,
user_id: ctx.userId, user_id: ctx.userId,
...@@ -55,15 +56,9 @@ class searchHistoryService extends Service { ...@@ -55,15 +56,9 @@ class searchHistoryService extends Service {
if (type) { if (type) {
filter.where.house_style = type; filter.where.house_style = type;
} }
let list = [];
let searchHistoryList = await ctx.realestateModel.SearchHistory.all(filter); let searchHistoryList = await ctx.realestateModel.SearchHistory.all(filter);
if (searchHistoryList.length > 0) { let list = searchHistoryList.map(v => { return v.key_word });
for (let i in searchHistoryList) {
if (list.indexOf(searchHistoryList[i].key_word) === -1) {
list.push(searchHistoryList[i].key_word);
}
}
}
ctx.logger.info(list); ctx.logger.info(list);
ret = { ret = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment