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
12e0f3b2
Commit
12e0f3b2
authored
Aug 22, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
house 2.2 add recommend houses
parent
63eec052
Pipeline
#12725
passed with stage
in 7 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
13 deletions
+56
-13
house_analysis.js
app/controller/house/v2/house_analysis.js
+1
-1
rental_house.js
app/controller/house/v2/rental_house.js
+10
-0
new_house.js
app/model/realestate/new_house.js
+1
-1
rental_house.js
app/model/realestate/rental_house.js
+1
-1
house.js
app/router/house.js
+1
-0
new_house.js
app/service/house/v2/new_house.js
+14
-10
rental_house.js
app/service/house/v2/rental_house.js
+28
-0
No files found.
app/controller/house/v2/house_analysis.js
View file @
12e0f3b2
...
@@ -25,7 +25,7 @@ class HouseAnalysisController extends Controller {
...
@@ -25,7 +25,7 @@ class HouseAnalysisController extends Controller {
const
results
=
await
ctx
.
service
.
house
.
v2
.
houseAnalysis
.
getHouseAnalysis
(
house_analysis_id
);
const
results
=
await
ctx
.
service
.
house
.
v2
.
houseAnalysis
.
getHouseAnalysis
(
house_analysis_id
);
//推荐楼盘
//推荐楼盘
let
where
=
{
corner
:
{
$ne
:
''
}
};
let
where
=
{
corner
:
{
$ne
:
''
}
,
status
:
'online'
,
valid
:
1
};
if
(
city_code
)
{
if
(
city_code
)
{
where
.
option_city_code
=
city_code
;
where
.
option_city_code
=
city_code
;
}
}
...
...
app/controller/house/v2/rental_house.js
View file @
12e0f3b2
...
@@ -58,6 +58,16 @@ class RentalHouseController extends Controller {
...
@@ -58,6 +58,16 @@ class RentalHouseController extends Controller {
ctx
.
success
(
ret
);
ctx
.
success
(
ret
);
}
}
//推荐楼盘
async
getRecommendRentalHouses
()
{
const
{
ctx
}
=
this
;
const
input_params
=
ctx
.
query
;
const
results
=
await
ctx
.
service
.
house
.
v2
.
rentalHouse
.
getRecommendRentalHouses
(
input_params
);
ctx
.
success
({
results
});
}
}
}
module
.
exports
=
RentalHouseController
;
module
.
exports
=
RentalHouseController
;
app/model/realestate/new_house.js
View file @
12e0f3b2
...
@@ -276,7 +276,7 @@ module.exports = app => {
...
@@ -276,7 +276,7 @@ module.exports = app => {
}
}
NewHouse
.
list
=
async
(
data
=
{})
=>
{
NewHouse
.
list
=
async
(
data
=
{})
=>
{
const
limit
=
data
.
limit
?
data
.
limit
:
10
;
const
limit
=
data
.
limit
?
Number
(
data
.
limit
)
:
10
;
const
page
=
data
.
page
?
data
.
page
:
1
;
const
page
=
data
.
page
?
data
.
page
:
1
;
const
order
=
data
.
order
?
data
.
order
:
[];
const
order
=
data
.
order
?
data
.
order
:
[];
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
...
...
app/model/realestate/rental_house.js
View file @
12e0f3b2
...
@@ -182,7 +182,7 @@ module.exports = app => {
...
@@ -182,7 +182,7 @@ module.exports = app => {
}
}
RentalHouse
.
list
=
async
(
data
=
{})
=>
{
RentalHouse
.
list
=
async
(
data
=
{})
=>
{
const
limit
=
data
.
limit
?
data
.
limit
:
10
;
const
limit
=
data
.
limit
?
Number
(
data
.
limit
)
:
10
;
const
page
=
data
.
page
?
data
.
page
:
1
;
const
page
=
data
.
page
?
data
.
page
:
1
;
const
order
=
data
.
order
?
data
.
order
:
[];
const
order
=
data
.
order
?
data
.
order
:
[];
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
const
attributes
=
data
.
attributes
?
data
.
attributes
:
{};
...
...
app/router/house.js
View file @
12e0f3b2
...
@@ -72,6 +72,7 @@ module.exports = app => {
...
@@ -72,6 +72,7 @@ module.exports = app => {
router
.
post
(
'/v2/rental_house/list'
,
'house.v2.rentalHouse.getRentalHouses'
);
//租房列表
router
.
post
(
'/v2/rental_house/list'
,
'house.v2.rentalHouse.getRentalHouses'
);
//租房列表
router
.
get
(
'/v2/rental_house/info/:rental_house_id'
,
'house.v2.rentalHouse.getRentalHouse'
);
//住房详情
router
.
get
(
'/v2/rental_house/info/:rental_house_id'
,
'house.v2.rentalHouse.getRentalHouse'
);
//住房详情
router
.
get
(
'/v2/options/:city_code'
,
'house.v2.options.getOptions'
);
//筛选项信息
router
.
get
(
'/v2/options/:city_code'
,
'house.v2.options.getOptions'
);
//筛选项信息
router
.
get
(
'/v2/rental_house/list/recommend'
,
'house.v2.rentalHouse.getRecommendRentalHouses'
);
//推荐的租房楼盘 基本可通用
//足迹
//足迹
router
.
get
(
'/v2/foot_print/list'
,
'house.v2.footPrint.getFootPrintList'
);
//用户浏览记录列表
router
.
get
(
'/v2/foot_print/list'
,
'house.v2.footPrint.getFootPrintList'
);
//用户浏览记录列表
...
...
app/service/house/v2/new_house.js
View file @
12e0f3b2
...
@@ -459,24 +459,28 @@ class NewHouseService extends Service {
...
@@ -459,24 +459,28 @@ class NewHouseService extends Service {
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
//推荐楼盘
//推荐楼盘
let
where
=
{
corner
:
{
$ne
:
''
}
};
let
{
city_code
,
page
,
limit
,
total_price
}
=
condition
;
let
{
city_code
,
page
,
limit
,
}
=
condition
;
page
=
page
?
page
:
1
;
page
=
page
?
page
:
1
;
limit
=
limit
?
limit
:
3
;
limit
=
limit
?
limit
:
3
;
let
where
=
{
corner
:
{
$ne
:
''
},
status
:
'online'
,
valid
:
1
};
let
order
=
[];
if
(
city_code
)
{
if
(
city_code
)
{
where
.
option_city_code
=
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'
,
'desc'
]]
});
if
(
total_price
)
{
where
.
reference_total_price
=
{
$ne
:
0
};
order
.
push
([
'reference_total_price'
,
total_price
]);
}
order
.
push
([
'order_id'
,
'desc'
]);
let
new_houses_rows
=
await
ctx
.
realestateModel
.
NewHouse
.
list
({
page
:
page
,
limit
:
limit
,
where
:
where
,
order
:
order
});
const
similar_list
=
[];
const
similar_list
=
[];
for
(
let
i
in
new_houses_rows
.
rows
)
{
for
(
let
i
in
new_houses_rows
.
rows
)
{
const
new_house
=
new_houses_rows
.
rows
[
i
];
const
new_house
=
new_houses_rows
.
rows
[
i
];
similar_list
.
push
({
const
temp_house
=
await
this
.
formatNewHouseBasic
(
new_house
);
id
:
new_house
.
id
,
temp_house
.
can_gjj_loan
=
new_house
.
corner
?
1
:
0
;
name
:
new_house
.
name
,
similar_list
.
push
(
temp_house
);
image
:
new_house
.
image
,
corner
:
new_house
.
corner
,
can_gjj_loan
:
new_house
.
corner
?
1
:
0
,
});
}
}
return
similar_list
;
return
similar_list
;
...
...
app/service/house/v2/rental_house.js
View file @
12e0f3b2
...
@@ -205,6 +205,34 @@ class RentalHouseService extends Service {
...
@@ -205,6 +205,34 @@ class RentalHouseService extends Service {
return
ret
;
return
ret
;
}
}
//获取推荐楼盘 目前推荐逻辑条件少 后面扩展
async
getRecommendRentalHouses
(
condition
)
{
const
{
ctx
}
=
this
;
//推荐楼盘
let
{
city_code
,
page
,
limit
,
price
}
=
condition
;
page
=
page
?
page
:
1
;
limit
=
limit
?
limit
:
3
;
let
where
=
{
status
:
'online'
,
valid
:
1
};
let
order
=
[];
if
(
city_code
)
{
where
.
option_city_code
=
city_code
;
}
if
(
price
)
{
where
.
price
=
{
$ne
:
0
};
order
.
push
([
'price'
,
price
]);
}
order
.
push
([
'order_id'
,
'desc'
]);
let
rental_houses_rows
=
await
ctx
.
realestateModel
.
RentalHouse
.
list
({
page
,
limit
,
where
,
order
});
const
recommend_list
=
await
this
.
formatRentalHouseBasic
(
rental_houses_rows
.
rows
);
const
recommend_result
=
R
.
project
([
'id'
,
'image'
,
'name'
,
'address'
,
'price'
,
'surplus_amount'
,
'tags'
,
'favourable_info'
])(
recommend_list
);
return
recommend_result
;
}
}
}
module
.
exports
=
RentalHouseService
;
module
.
exports
=
RentalHouseService
;
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