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
a030e2cb
Commit
a030e2cb
authored
Jun 04, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二期 rental_house residential fix
parent
412fe50f
Pipeline
#8508
passed with stage
in 11 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
0 deletions
+71
-0
developer.js
app/service/house/developer.js
+43
-0
house_image.js
app/service/house/house_image.js
+28
-0
No files found.
app/service/house/developer.js
0 → 100644
View file @
a030e2cb
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
const
R
=
require
(
'ramda'
);
class
DeveloperService
extends
Service
{
/**
* 通過城市编号获取小区列表
* @param {object} condition {type: XX, connect_id: XX}
* @param {object} elements [id, path, ...]//需要筛选出的元素
*/
async
getDevelopers
(
condition
,
elements
=
[])
{
const
{
ctx
}
=
this
;
const
{
city_code
,
district_code
,
bizcircle_code
}
=
condition
;
let
where
=
{};
if
(
bizcircle_code
)
{
const
residentials
=
await
ctx
.
realestateModel
.
ResidentialDeveloper
.
all
({
where
:
{
region
:
bizcircle_code
}
});
const
residentials_ids
=
R
.
pluck
(
'developer_id'
,
residentials
);
where
.
id
=
{
$in
:
residentials_ids
}
}
else
if
(
district_code
)
{
const
residentials
=
await
ctx
.
realestateModel
.
ResidentialDeveloper
.
all
({
where
:
{
county
:
district_code
}
});
const
residentials_ids
=
R
.
pluck
(
'developer_id'
,
residentials
);
where
.
id
=
{
$in
:
residentials_ids
}
}
else
if
(
city_code
)
{
const
residentials
=
await
ctx
.
realestateModel
.
ResidentialDeveloper
.
all
({
where
:
{
city
:
city_code
}
});
const
residentials_ids
=
R
.
pluck
(
'developer_id'
,
residentials
);
where
.
id
=
{
$in
:
residentials_ids
}
}
let
ret
=
await
ctx
.
realestateModel
.
Developer
.
all
({
where
:
where
});
if
(
Array
.
isArray
(
elements
)
&&
elements
.
length
!==
0
)
{
ret
=
R
.
project
(
elements
)(
ret
);
}
return
ret
;
}
}
module
.
exports
=
DeveloperService
;
app/service/house/house_image.js
0 → 100644
View file @
a030e2cb
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
const
R
=
require
(
'ramda'
);
class
HouseImageService
extends
Service
{
/**
* 获取图片相册
* @param {object} condition {type: XX, connect_id: XX}
* @param {object} elements [id, path, ...]//需要筛选出的元素
*/
async
getAll
(
condition
,
elements
=
[])
{
const
{
ctx
}
=
this
;
const
{
type
,
connect_id
}
=
condition
;
if
(
type
===
undefined
||
!
connect_id
)
{
return
[];
}
let
ret
=
await
ctx
.
realestateModel
.
HouseImage
.
all
({
where
:
{
status
:
'online'
,
valid
:
1
,
type
:
type
,
connect_id
:
connect_id
}
});
if
(
Array
.
isArray
(
elements
)
&&
elements
.
length
!==
0
)
{
ret
=
R
.
project
(
elements
)(
ret
);
}
return
ret
;
}
}
module
.
exports
=
HouseImageService
;
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