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
c45a76c9
Commit
c45a76c9
authored
Apr 25, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
house tool fix
parent
cc304288
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
tool.js
app/controller/house/tool.js
+11
-0
tool.js
app/service/house/tool.js
+9
-0
No files found.
app/controller/house/tool.js
View file @
c45a76c9
...
@@ -91,6 +91,7 @@ class ToolController extends Controller {
...
@@ -91,6 +91,7 @@ class ToolController extends Controller {
const
input_parmas
=
ctx
.
request
.
body
;
const
input_parmas
=
ctx
.
request
.
body
;
const
rule
=
{
const
rule
=
{
area_code
:
{
type
:
'string'
,
required
:
true
},
area_code
:
{
type
:
'string'
,
required
:
true
},
area_name
:
{
type
:
'string'
,
required
:
true
},
down_payment
:
{
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
}
total_price
:
{
type
:
'string'
,
required
:
true
}
...
@@ -105,6 +106,7 @@ class ToolController extends Controller {
...
@@ -105,6 +106,7 @@ class ToolController extends Controller {
// const target_house = await ctx.blockModel.HousePriceMap.one({ where: { id: input_parmas.area_code } });
// const target_house = await ctx.blockModel.HousePriceMap.one({ where: { id: input_parmas.area_code } });
const
area_code
=
input_parmas
.
area_code
;
const
area_code
=
input_parmas
.
area_code
;
const
total_price
=
input_parmas
.
total_price
;
const
total_price
=
input_parmas
.
total_price
;
const
area_name
=
input_parmas
.
area_name
;
let
filter
=
{
let
filter
=
{
total_price
:
{
min
:
total_price
-
300000
,
max
:
total_price
+
300000
},
total_price
:
{
min
:
total_price
-
300000
,
max
:
total_price
+
300000
},
area_code
:
{
bizcircle_code
:
area_code
},
area_code
:
{
bizcircle_code
:
area_code
},
...
@@ -130,8 +132,17 @@ class ToolController extends Controller {
...
@@ -130,8 +132,17 @@ class ToolController extends Controller {
// const recommend_houses = [];//推荐房源
// const recommend_houses = [];//推荐房源
const
house_plan
=
await
ctx
.
service
.
house
.
tool
.
generateHousePlan
(
input_parmas
);
//计算购房能力 生成购房计划
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
=
{
const
ret
=
{
house_plan
,
house_plan
,
fine_houses
,
recommend_houses
,
recommend_houses
,
}
}
...
...
app/service/house/tool.js
View file @
c45a76c9
...
@@ -22,6 +22,12 @@ class ToolService extends Service {
...
@@ -22,6 +22,12 @@ class ToolService extends Service {
const
ret
=
[];
const
ret
=
[];
for
(
let
i
in
map_points
)
{
for
(
let
i
in
map_points
)
{
const
item
=
map_points
[
i
];
const
item
=
map_points
[
i
];
if
(
item
.
price
&&
!
item
.
price
){
continue
;
}
if
(
item
.
count
&&
!
item
.
count
){
continue
;
}
ret
.
push
({
ret
.
push
({
id
:
item
.
id
,
id
:
item
.
id
,
name
:
item
.
name
,
name
:
item
.
name
,
...
@@ -55,6 +61,9 @@ class ToolService extends Service {
...
@@ -55,6 +61,9 @@ class ToolService extends Service {
const
ret
=
[];
const
ret
=
[];
for
(
let
i
in
map_points
)
{
for
(
let
i
in
map_points
)
{
const
item
=
map_points
[
i
];
const
item
=
map_points
[
i
];
if
(
item
.
price
&&
!
item
.
price
){
continue
;
}
ret
.
push
({
ret
.
push
({
id
:
item
.
id
,
id
:
item
.
id
,
name
:
item
.
name
,
name
:
item
.
name
,
...
...
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