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
2c047410
Commit
2c047410
authored
Jun 14, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add recommend new house
parent
541c0b71
Pipeline
#8921
passed with stage
in 14 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
2 deletions
+48
-2
new_house.js
app/controller/house/v2/new_house.js
+10
-0
house.js
app/router/house.js
+1
-0
new_house.js
app/service/house/v2/new_house.js
+27
-0
rental_house.js
app/service/house/v2/rental_house.js
+7
-2
tool.js
app/service/house/v2/tool.js
+3
-0
No files found.
app/controller/house/v2/new_house.js
View file @
2c047410
...
...
@@ -47,6 +47,16 @@ class NewHouseController extends Controller {
const
ret
=
await
ctx
.
service
.
house
.
newHouse
.
getNewHouseType
(
inputParams
.
id
);
ctx
.
success
(
ret
);
}
//推荐楼盘
async
getRecommendNewHouses
()
{
const
{
ctx
}
=
this
;
const
input_params
=
ctx
.
query
;
const
results
=
await
ctx
.
service
.
house
.
v2
.
newHouse
.
getRecommendNewHouses
(
input_params
);
ctx
.
success
({
results
});
}
}
module
.
exports
=
NewHouseController
;
app/router/house.js
View file @
2c047410
...
...
@@ -74,6 +74,7 @@ module.exports = app => {
router
.
post
(
'/v2/new_house/list'
,
'house.v2.newHouse.getNewHouseList'
);
//根据条件筛选列表
router
.
get
(
'/v2/new_house/:id'
,
'house.v2.newHouse.getNewHouse'
);
//新房具体信息
router
.
get
(
'/v2/new_house/options/:city_code'
,
'house.v2.options.getNewHouseOptions'
);
//筛选项信息
router
.
get
(
'/v2/new_house/list/recommend/'
,
'house.v2.newHouse.getRecommendNewHouses'
);
//推荐的新房楼盘 基本可通用
//关注
router
.
post
(
'/v2/collection'
,
loginAuth
,
'house.v2.collection.addCollection'
);
//关注
...
...
app/service/house/v2/new_house.js
View file @
2c047410
...
...
@@ -432,6 +432,33 @@ class NewHouseService extends Service {
return
ret
;
}
//获取推荐楼盘 目前推荐逻辑条件少 后面扩展
async
getRecommendNewHouses
(
condition
)
{
const
{
ctx
}
=
this
;
//推荐楼盘
let
where
=
{
corner
:
{
$ne
:
''
}
};
let
{
city_code
,
page
,
limit
,
}
=
condition
;
page
=
page
?
page
:
1
;
limit
=
limit
?
limit
:
3
;
if
(
city_code
)
{
where
.
option_city_code
=
city_code
;
}
let
new_houses_rows
=
await
ctx
.
realestateModel
.
NewHouse
.
list
({
page
:
page
,
limit
:
limit
,
where
:
where
,
order
:
[[
'order_id'
,
'asc'
]]
});
const
similar_list
=
[];
for
(
let
i
in
new_houses_rows
.
rows
)
{
const
new_house
=
new_houses_rows
.
rows
[
i
];
similar_list
.
push
({
id
:
new_house
.
id
,
name
:
new_house
.
name
,
image
:
new_house
.
image
,
corner
:
new_house
.
corner
,
});
}
return
similar_list
;
}
}
module
.
exports
=
NewHouseService
;
app/service/house/v2/rental_house.js
View file @
2c047410
...
...
@@ -17,6 +17,7 @@ const HOUSE_TYPE = [
class
RentalHouseService
extends
Service
{
//租房条件过滤
async
getRentalHousesByFilter
(
condition
)
{
const
{
ctx
}
=
this
;
...
...
@@ -50,7 +51,11 @@ class RentalHouseService extends Service {
if
(
house_type
)
{
const
house_types
=
await
ctx
.
realestateModel
.
RentalHouseType
.
all
({
where
:
{
type
:
house_type
,
status
:
'online'
,
valid
:
1
}
});
const
rental_houses_ids
=
R
.
pluck
(
'rental_house_id'
,
house_types
);
where
.
id
=
{
$in
:
rental_houses_ids
};
let
match_ids
=
new
Set
(
rental_houses_ids
);
match_ids
=
[...
match_ids
];
if
(
Array
.
isArray
(
match_ids
)
&&
match_ids
.
length
!==
0
)
{
where
.
id
=
{
$in
:
match_ids
};
}
}
const
rental_houses_results
=
await
ctx
.
realestateModel
.
RentalHouse
.
list
({
page
:
page
,
limit
:
Number
(
limit
),
where
:
where
,
order
:
[[
'order_id'
,
'asc'
]]
});
...
...
@@ -87,7 +92,7 @@ class RentalHouseService extends Service {
let
house_basic
=
await
this
.
formatRentalHouseBasic
([
rental_house_info
]);
house_basic
=
house_basic
[
0
];
//
TODO
添加用户足迹,是否关注过房源
//添加用户足迹,是否关注过房源
await
ctx
.
service
.
house
.
v2
.
footPrint
.
addFootPrint
({
type
:
2
,
id
:
rental_house_id
});
//是否关注
let
collectionTask
=
await
ctx
.
service
.
house
.
collection
.
getCollection
({
type
:
2
,
id
:
rental_house_id
});
...
...
app/service/house/v2/tool.js
View file @
2c047410
...
...
@@ -5,6 +5,7 @@ const Service = require('egg').Service;
class
ToolService
extends
Service
{
//新房地图点位
async
getNewHouseMapPoint
(
area_code
,
level
)
{
const
{
ctx
}
=
this
;
...
...
@@ -43,6 +44,7 @@ class ToolService extends Service {
return
ret
;
}
//二手房地图点位
async
getUsedHouseMapPoint
(
area_code
,
level
)
{
const
{
ctx
}
=
this
;
...
...
@@ -78,6 +80,7 @@ class ToolService extends Service {
return
ret
;
}
//存钱罐计算完毕后 生成购房计划
async
generateHousePlan
(
input
)
{
const
{
ctx
}
=
this
;
...
...
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