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
412fe50f
Commit
412fe50f
authored
Jun 04, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二期 rental_house residential fix
parent
e2dfced7
Pipeline
#8506
passed with stage
in 11 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
rental_house.js
app/service/house/rental_house.js
+23
-0
residential.js
app/service/house/residential.js
+23
-0
No files found.
app/service/house/rental_house.js
View file @
412fe50f
...
...
@@ -3,6 +3,7 @@
const
Service
=
require
(
'egg'
).
Service
;
const
R
=
require
(
'ramda'
);
const
HOUSE_TYPE
=
[
{
name
:
'不限'
,
min
:
0
,
max
:
0
,
value
:
0
,
},
{
name
:
'1室'
,
min
:
1
,
max
:
1
,
value
:
1
,
},
...
...
@@ -15,6 +16,28 @@ const HOUSE_TYPE = [
]
class
RentalHouseService
extends
Service
{
async
getRentalHouseByFilter_V2
(
condition
)
{
const
{
ctx
}
=
this
;
const
{
brand
,
price
,
house_type
,
area_code
,
name
,
}
=
condition
;
let
where
=
{};
if
(
brand
)
{
const
residentials
=
await
ctx
.
service
.
house
.
residential
.
getResidentialByDeveloper
({
developer_id
:
brand
});
const
residentials_ids
=
R
.
pluck
(
'id'
,
residentials
);
}
if
(
area_code
)
{
}
if
(
house_type
)
{
}
if
(
name
)
{
where
.
name
=
{
$like
:
`%
${
name
}
%`
};
}
}
async
getRentalHousesByFilter
(
condition
)
{
const
{
ctx
}
=
this
;
...
...
app/service/house/residential.js
View file @
412fe50f
...
...
@@ -12,6 +12,29 @@ class ResidentialService extends Service {
return
residentialInfo
;
}
//通过开发商id获取小区列表
async
getResidentialByDeveloper
(
condition
,
elements
=
[])
{
const
{
ctx
}
=
this
;
const
{
developer_id
}
=
condition
;
if
(
!
developer_id
)
{
return
[];
}
const
residential_developer
=
await
ctx
.
realestateModel
.
ResidentialDeveloper
.
all
({
where
:
{
developer_id
:
developer_id
,
status
:
'online'
,
valid
:
1
}
});
const
residential_ids
=
R
.
pluck
(
'residential_id'
,
residential_developer
);
if
(
residential_ids
.
length
===
0
)
{
return
[];
}
let
residentials
=
await
ctx
.
realestateModel
.
Residential
.
all
({
where
:
{
id
:
{
$in
:
residential_ids
},
status
:
'online'
,
valid
:
1
}
});
if
(
Array
.
isArray
(
elements
)
&&
elements
.
length
!==
0
)
{
residentials
=
R
.
project
(
elements
)(
residentials
);
}
return
residentials
;
}
}
...
...
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