Commit 9dd2a6b0 authored by 李尚科's avatar 李尚科

tool fix

parent f68596c8
Pipeline #6076 passed with stage
in 3 seconds
......@@ -89,21 +89,38 @@ class ToolController extends Controller {
const { ctx } = this;
const input_parmas = ctx.request.body;
const rule = {
city_code: { type: 'string', required: true },
area_code: { type: 'string', required: true },
down_payment: { type: 'string', required: true },
invest_payment: { type: 'string', required: true }
invest_payment: { type: 'string', required: true },
total_price: { type: 'string', required: true }
}
ctx.validate(rule, input_parmas);
const target_house = await ctx.blockModel.HousePriceMap.one({ where: { id: input_parmas.city_code } });
let target_price = 0;
if (target_house && target_house.price) {
target_price = target_house.price;
// 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;
let filter = {
total_price: { min: total_price - 300000, max: total_price + 300000 },
area_code: { bizcircle_code: area_code },
}
const filter = {
price: { min: target_price - 300000, max: target_price + 300000 },
let recommend_houses = await ctx.service.house.newHouse.getNewHouseList(filter);//推荐房源
if (recommend_houses.count === 0) {
filter = {
total_price: { min: total_price - 300000, max: total_price + 300000 },
area_code: { district_code: area_code },
}
recommend_houses = await ctx.service.house.newHouse.getNewHouseList(filter);//推荐房源
}
if (recommend_houses.count === 0) {
filter = {
total_price: { min: total_price - 300000, max: total_price + 300000 },
area_code: { city_code: area_code },
}
recommend_houses = await ctx.service.house.newHouse.getNewHouseList(filter);//推荐房源
}
const recommend_houses = await ctx.service.house.rentalHouse.getRentalHousesByFilter(filter);//推荐房源
recommend_houses = recommend_houses.results.splice(0, 4);
// const recommend_houses = [];//推荐房源
const house_plan = await ctx.service.house.tool.generateHousePlan(input_parmas);//计算购房能力 生成购房计划
......@@ -192,7 +209,7 @@ class ToolController extends Controller {
});
ctx.logger.info('qfang_url_chaxun_result: ' + JSON.stringify(ret2));
if(ret2.status !== 200){
if (ret2.status !== 200) {
ctx.failed('估算过程中出了点错,请稍后再试!');
}
......
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