Commit c45a76c9 authored by 李尚科's avatar 李尚科

house tool fix

parent cc304288
......@@ -91,6 +91,7 @@ class ToolController extends Controller {
const input_parmas = ctx.request.body;
const rule = {
area_code: { type: 'string', required: true },
area_name: { type: 'string', required: true },
down_payment: { type: 'string', required: true },
invest_payment: { type: 'string', required: true },
total_price: { type: 'string', required: true }
......@@ -105,6 +106,7 @@ class ToolController extends Controller {
// const target_house = await ctx.blockModel.HousePriceMap.one({ where: { id: input_parmas.area_code } });
const area_code = input_parmas.area_code;
const total_price = input_parmas.total_price;
const area_name = input_parmas.area_name;
let filter = {
total_price: { min: total_price - 300000, max: total_price + 300000 },
area_code: { bizcircle_code: area_code },
......@@ -130,8 +132,17 @@ class ToolController extends Controller {
// const recommend_houses = [];//推荐房源
const house_plan = await ctx.service.house.tool.generateHousePlan(input_parmas);//计算购房能力 生成购房计划
let fine_houses = [];
if (house_plan.status !== 0) {
filter = {
name: area_name,
}
fine_houses = await ctx.service.house.newHouse.getNewHouseList(filter);//推荐房源
fine_houses = fine_houses.results.splice(0, 1);
}
const ret = {
house_plan,
fine_houses,
recommend_houses,
}
......
......@@ -22,6 +22,12 @@ class ToolService extends Service {
const ret = [];
for (let i in map_points) {
const item = map_points[i];
if(item.price && !item.price){
continue;
}
if(item.count && !item.count){
continue;
}
ret.push({
id: item.id,
name: item.name,
......@@ -55,6 +61,9 @@ class ToolService extends Service {
const ret = [];
for (let i in map_points) {
const item = map_points[i];
if(item.price && !item.price){
continue;
}
ret.push({
id: item.id,
name: item.name,
......
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