Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
方斌
51business
Commits
9dd2a6b0
Commit
9dd2a6b0
authored
Apr 17, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tool fix
parent
f68596c8
Pipeline
#6076
passed with stage
in 3 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
10 deletions
+27
-10
tool.js
app/controller/house/tool.js
+27
-10
No files found.
app/controller/house/tool.js
View file @
9dd2a6b0
...
...
@@ -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
(
'估算过程中出了点错,请稍后再试!'
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment