Commit b930196a authored by Hsinli's avatar Hsinli

add

parent 1607e123
Pipeline #19671 passed with stage
in 59 seconds
'use strict';
const Controller = require('egg').Controller;
class PresellHouseController extends Controller {
/**
* 预售楼盘列表
*/
async getPresellHouseList() {
const { ctx } = this;
let inputParams = ctx.request.body;
let rule = {
page: { type: 'number', required: true },
limit: { type: 'number', required: true },
name: { type: 'string', required: false },
};
ctx.validate(rule, inputParams);
let ret = await ctx.service.cd.presellHouse.getList(inputParams);
ctx.success(ret);
}
}
module.exports = PresellHouseController;
...@@ -27,7 +27,12 @@ class PresellHouseService extends Service { ...@@ -27,7 +27,12 @@ class PresellHouseService extends Service {
}, },
order: [['market_time', 'desc']] order: [['market_time', 'desc']]
} }
let list = await ctx.realestateModel.CdNews.findAndCountAll(filter); if (condition.name) {//关键词搜索 模糊查询
//增加搜索历史
await ctx.service.cd.presellSearchHistory.addSearchHistory(condition.name);
filter.where.name = { $like: '%' + condition.name + '%' }
}
let list = await ctx.realestateModel.CdPresellHouse.findAndCountAll(filter);
let ret = { let ret = {
list: list.rows, list: list.rows,
page: page, page: page,
......
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