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
1fc08414
Commit
1fc08414
authored
Apr 11, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
c23e79f0
Pipeline
#5886
passed with stage
in 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
0 deletions
+64
-0
options.js
app/controller/house/options.js
+15
-0
option.js
app/service/house/option.js
+49
-0
No files found.
app/controller/house/options.js
View file @
1fc08414
...
...
@@ -15,6 +15,21 @@ class OptionsController extends Controller {
const
ret
=
await
ctx
.
service
.
house
.
option
.
getOptions
(
city_code
);
ctx
.
success
(
ret
);
}
/**
* 获取新房的筛选项
*/
async
getNewHouseOptions
()
{
const
{
ctx
}
=
this
;
const
input_parmas
=
ctx
.
params
;
const
rule
=
{
city_code
:
{
type
:
'string'
,
required
:
true
}
}
ctx
.
validate
(
rule
,
input_parmas
);
const
city_code
=
input_parmas
.
city_code
;
const
ret
=
await
ctx
.
service
.
house
.
option
.
getNewHouseOptions
(
city_code
);
ctx
.
success
(
ret
);
}
}
module
.
exports
=
OptionsController
;
app/service/house/option.js
View file @
1fc08414
...
...
@@ -4,6 +4,7 @@
const
Service
=
require
(
'egg'
).
Service
;
const
PRICE_RANGE
=
[
{
name
:
'不限'
,
min
:
0
,
max
:
0
},
{
name
:
'2000元以下'
,
min
:
0
,
max
:
2000
},
{
name
:
'2000元-3000元'
,
min
:
2000
,
max
:
3000
},
{
name
:
'3000元-4000元'
,
min
:
3000
,
max
:
4000
},
...
...
@@ -16,6 +17,7 @@ const PRICE_RANGE = [
]
const
HOUSE_TYPE
=
[
{
name
:
'不限'
,
min
:
0
,
max
:
0
,
value
:
0
,
},
{
name
:
'1室'
,
min
:
1
,
max
:
1
,
value
:
1
,
},
{
name
:
'2室'
,
min
:
2
,
max
:
2
,
value
:
2
,
},
{
name
:
'3室'
,
min
:
3
,
max
:
3
,
value
:
3
,
},
...
...
@@ -25,6 +27,42 @@ const HOUSE_TYPE = [
{
name
:
'别墅'
,
min
:
10000
,
max
:
10000000
,
value
:
7
,
},
]
const
NEW_HOUSE_UNIT_PRICE
=
[
{
name
:
'不限'
,
min
:
0
,
max
:
0
},
{
name
:
'1万以下'
,
min
:
0
,
max
:
10000
},
{
name
:
'1万-2万'
,
min
:
10000
,
max
:
20000
},
{
name
:
'2万-3万'
,
min
:
20000
,
max
:
30000
},
{
name
:
'3万-4万'
,
min
:
30000
,
max
:
40000
},
{
name
:
'4万-5万'
,
min
:
40000
,
max
:
50000
},
{
name
:
'5万-6万'
,
min
:
60000
,
max
:
70000
},
]
const
NEW_HOUSE_TOTAL_PRICE
=
[
{
name
:
'不限'
,
min
:
0
,
max
:
0
},
{
name
:
'100万以下'
,
min
:
0
,
max
:
100
},
{
name
:
'100万-200万'
,
min
:
100
,
max
:
200
},
{
name
:
'200万-300万'
,
min
:
200
,
max
:
300
},
{
name
:
'300万-400万'
,
min
:
300
,
max
:
400
},
{
name
:
'400万-500万'
,
min
:
400
,
max
:
500
},
{
name
:
'500万-600万'
,
min
:
500
,
max
:
600
},
{
name
:
'600万-700万'
,
min
:
600
,
max
:
700
},
{
name
:
'700万-800万'
,
min
:
700
,
max
:
800
},
{
name
:
'800万-900万'
,
min
:
800
,
max
:
900
},
{
name
:
'900万-1000万'
,
min
:
900
,
max
:
1000
},
{
name
:
'1000万以上'
,
min
:
1000
,
max
:
0
},
]
const
NEW_HOUSE_AREA
=
[
{
name
:
'不限'
,
min
:
0
,
max
:
0
},
{
name
:
'50平米以下'
,
min
:
0
,
max
:
50
},
{
name
:
'50平米-70平米'
,
min
:
50
,
max
:
70
},
{
name
:
'70平米-90平米'
,
min
:
70
,
max
:
90
},
{
name
:
'90平米-120平米'
,
min
:
90
,
max
:
120
},
{
name
:
'120平米-150平米'
,
min
:
120
,
max
:
150
},
{
name
:
'150平米-200平米'
,
min
:
150
,
max
:
200
},
{
name
:
'200平米以上'
,
min
:
200
,
max
:
999
}
]
class
OptionService
extends
Service
{
//获取筛选项
...
...
@@ -38,6 +76,17 @@ class OptionService extends Service {
return
{
result
:
{
brands
,
prices
,
house_types
,
areas
}
};
}
//获取新房的筛选项
async
getNewHouseOptions
(
city_code
)
{
const
unit_price
=
NEW_HOUSE_UNIT_PRICE
;
const
total_price
=
NEW_HOUSE_UNIT_PRICE
;
const
house_types
=
HOUSE_TYPE
;
const
house_area
=
NEW_HOUSE_AREA
;
const
areas
=
await
this
.
getAreaOptions
(
city_code
);
return
{
result
:
{
house_area
,
unit_price
,
total_price
,
house_types
,
areas
}
};
}
//获取开发商列表
async
getDevelopers
()
{
...
...
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