Commit 88c4993b authored by 李尚科's avatar 李尚科
parents fa56abbd 24044d4a
Pipeline #8740 passed with stage
in 3 seconds
...@@ -380,7 +380,7 @@ class NewHouseService extends Service { ...@@ -380,7 +380,7 @@ class NewHouseService extends Service {
type: 1, type: 1,
key_word: condition.name key_word: condition.name
}; };
await ctx.service.house.searchHistory.addSearchHistory(addHistory); await ctx.service.house.v2.searchHistory.addSearchHistory(addHistory);
filter.where.name = { $like: '%' + condition.name + '%' } filter.where.name = { $like: '%' + condition.name + '%' }
} }
if (condition.area_code) {//城市\区域\商圈筛选 if (condition.area_code) {//城市\区域\商圈筛选
......
...@@ -42,10 +42,10 @@ class searchHistoryService extends Service { ...@@ -42,10 +42,10 @@ class searchHistoryService extends Service {
//如果没有登录就返回空 //如果没有登录就返回空
return ret; return ret;
} }
let endDate = moment().subtract(180, 'days').format('YYYY-MM-DD HH:mm:ss'); let endDate = moment().subtract(6, 'months').format('YYYY-MM-DD HH:mm:ss');
let filter = { let filter = {
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 +55,9 @@ class searchHistoryService extends Service { ...@@ -55,15 +55,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.findAll(filter);
let searchHistoryList = await ctx.realestateModel.SearchHistory.all(filter); let list = searchHistoryList.map(v => { return v.key_word });
if (searchHistoryList.length > 0) {
for (let i in searchHistoryList) {
if (list.indexOf(searchHistoryList[i].keyWord) === -1) {
list.push(searchHistoryList[i].keyWord);
}
}
}
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