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
f68596c8
Commit
f68596c8
authored
Apr 16, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rental house fix
parent
7167a32c
Pipeline
#6067
passed with stage
in 6 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
12 deletions
+30
-12
rental_house.js
app/controller/house/rental_house.js
+5
-3
rental_house.js
app/service/house/rental_house.js
+25
-9
No files found.
app/controller/house/rental_house.js
View file @
f68596c8
...
...
@@ -34,18 +34,20 @@ class RentalHouseController extends Controller {
//租房列表
async
getRentalHouses
()
{
const
{
ctx
}
=
this
;
const
query_params
=
ctx
.
query
;
const
input_params
=
ctx
.
request
.
body
;
const
rule
=
{
brand
:
{
type
:
'string'
,
required
:
false
},
//品牌
area_code
:
{
type
:
'
string
'
,
required
:
false
},
//区域
area_code
:
{
type
:
'
object
'
,
required
:
false
},
//区域
price
:
{
type
:
'object'
,
required
:
false
},
//价格
house_type
:
{
type
:
'string'
,
required
:
false
},
//房型
name
:
{
type
:
'string'
,
required
:
false
}
//楼盘名称
};
ctx
.
validate
(
rule
,
input_params
);
const
ret
=
await
ctx
.
service
.
house
.
rentalHouse
.
getRentalHousesByFilter
(
input_params
);
ctx
.
success
({
query_params
,
input_params
,
results
:
ret
,
count
:
ret
.
length
});
ctx
.
success
({
input_params
,
results
:
ret
.
results
,
count
:
ret
.
count
});
}
//租房详情
...
...
app/service/house/rental_house.js
View file @
f68596c8
...
...
@@ -46,12 +46,28 @@ class RentalHouseService extends Service {
operator
:
'equal'
,
});
}
if
(
condition
.
area_code
)
{
queryConditions
.
push
({
key
:
'county'
,
value
:
condition
.
area_code
,
operator
:
'equal'
,
});
if
(
condition
.
area_code
)
{
//城市\区域\商圈筛选
if
(
condition
.
area_code
.
hasOwnProperty
(
'city_code'
)
&&
condition
.
area_code
.
city_code
!==
''
)
{
queryConditions
.
push
({
key
:
'city'
,
value
:
condition
.
area_code
.
city_code
,
operator
:
'equal'
,
});
}
if
(
condition
.
area_code
.
hasOwnProperty
(
'district_code'
)
&&
condition
.
area_code
.
district_code
!==
''
)
{
queryConditions
.
push
({
key
:
'county'
,
value
:
condition
.
area_code
.
district_code
,
operator
:
'equal'
,
});
}
if
(
condition
.
area_code
.
hasOwnProperty
(
'bizcircle_code'
)
&&
condition
.
area_code
.
bizcircle_code
!==
''
)
{
queryConditions
.
push
({
key
:
'region'
,
value
:
condition
.
area_code
.
bizcircle_code
,
operator
:
'equal'
,
});
}
}
if
(
condition
.
name
)
{
await
ctx
.
service
.
house
.
searchHistory
.
addSearchHistory
({
type
:
2
,
key_word
:
condition
.
name
});
//增加搜索历史
...
...
@@ -77,7 +93,7 @@ class RentalHouseService extends Service {
const
rental_houses_results
=
await
ctx
.
service
.
houseCommon
.
rentalHouse
.
all
(
filter
);
let
rental_houses
=
await
this
.
formatRentalHouseBasic
(
rental_houses_results
.
results
);
rental_houses
=
R
.
project
([
'id'
,
'image'
,
'name'
,
'address'
,
'price'
,
'tags'
,
'favourable_info'
])(
rental_houses
);
return
rental_houses
;
return
{
results
:
rental_houses
,
count
:
rental_houses_results
.
rowCount
}
;
}
//房源详细信息
...
...
@@ -111,10 +127,10 @@ class RentalHouseService extends Service {
//处理房源基本信息格式
let
house_basic
=
await
this
.
formatRentalHouseBasic
([
house_basic_result
]);
house_basic
=
house_basic
[
0
];
//是否关注
const
collectionFilter
=
{
type
:
2
,
id
:
rental_house_id
}
const
collection
=
await
service
.
house
.
collection
.
getCollection
(
collectionFilter
);
const
collection
=
await
ctx
.
service
.
house
.
collection
.
getCollection
(
collectionFilter
);
ctx
.
service
.
house
.
footPrint
.
addFootPrint
({
id
:
rental_house_id
,
type
:
2
});
//添加用户足迹记录
...
...
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