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
a1df1a76
Commit
a1df1a76
authored
Apr 24, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adddd
parent
bddabb7f
Pipeline
#6408
passed with stage
in 9 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
179 additions
and
5 deletions
+179
-5
new_house.js
app/controller/house/new_house.js
+6
-5
new_house.js
app/service/house/new_house.js
+173
-0
No files found.
app/controller/house/new_house.js
View file @
a1df1a76
...
@@ -24,11 +24,12 @@ class NewHouseController extends Controller {
...
@@ -24,11 +24,12 @@ class NewHouseController extends Controller {
};
};
ctx
.
validate
(
rule
,
inputParams
);
ctx
.
validate
(
rule
,
inputParams
);
let
ret
=
{};
let
ret
=
{};
if
(
inputParams
.
hasOwnProperty
(
'type'
)
&&
inputParams
.
type
!==
''
)
{
// if (inputParams.hasOwnProperty('type') && inputParams.type !== '') {
ret
=
await
ctx
.
service
.
house
.
newHouse
.
getNewHouseListByType
(
inputParams
);
// ret = await ctx.service.house.newHouse.getNewHouseListByType(inputParams);
}
else
{
// } else {
ret
=
await
ctx
.
service
.
house
.
newHouse
.
getNewHouseList
(
inputParams
);
// ret = await ctx.service.house.newHouse.getNewHouseList(inputParams);
}
// }
ret
=
await
ctx
.
service
.
house
.
newHouse
.
getNewHouseListV2
(
inputParams
);
ctx
.
success
(
ret
);
ctx
.
success
(
ret
);
}
}
...
...
app/service/house/new_house.js
View file @
a1df1a76
...
@@ -479,6 +479,179 @@ class NewHouseService extends Service {
...
@@ -479,6 +479,179 @@ class NewHouseService extends Service {
return
ret
;
return
ret
;
}
}
async
getNewHouseListV2
(
condition
)
{
const
{
ctx
,
service
}
=
this
;
let
page
=
Number
(
condition
.
page
)
||
1
;
let
pageSize
=
Number
(
condition
.
page_size
)
||
30
;
let
filter
=
{
pageIndex
:
page
,
pageSize
:
pageSize
,
queryConditions
:
[{
key
:
"state"
,
value
:
1
,
operator
:
"equal"
}],
orderConditions
:
[],
}
//根据筛选项增加不同的指定类型
if
(
inputParams
.
hasOwnProperty
(
'type'
)
&&
inputParams
.
type
!==
''
)
{
if
(
type
===
'home'
)
{
//为您推荐只展示50条在售楼盘的数据,根据排序序号取数,数字小的排在前面,数字一样的情况下根据时间逆序排列,时间也一样的情况下随机排列;
filter
.
pageSize
=
Number
(
condition
.
page_size
)
||
50
;
filter
.
orderConditions
.
push
({
key
:
'orderNum'
,
orderSequence
:
'asc'
,
},
{
key
:
'createdAt'
,
orderSequence
:
'desc'
,
});
}
else
if
(
type
===
'all'
)
{
filter
.
orderConditions
.
push
({
key
:
'saleType'
,
orderSequence
:
'desc'
,
});
}
else
if
(
type
===
'sale'
)
{
//点击在售楼盘进入列表页面且只展示当前销售状态为在售的楼盘
filter
.
queryConditions
.
push
({
key
:
"saleType"
,
value
:
'3'
,
operator
:
"equal"
});
}
else
if
(
type
===
'open'
)
{
//只展示最近三个月内开盘的楼盘,往前追溯三个月,列表单次加载30条楼盘数据,滑到底部再次加载30条
let
endDate
=
moment
().
subtract
(
30
,
'days'
).
format
(
'YYYY-MM-DD HH:mm:ss'
);
filter
.
queryConditions
.
push
({
key
:
"openDate"
,
value
:
endDate
,
operator
:
"greater"
});
filter
.
orderConditions
.
push
({
key
:
'saleType'
,
orderSequence
:
'desc'
,
})
}
else
if
(
type
===
'favourable'
)
{
//点击优惠好盘只展示有优惠的楼盘,列表单次加载30条楼盘数据,滑到底部再次加载30条
filter
.
queryConditions
.
push
({
key
:
"favourableInfo"
,
value
:
false
,
operator
:
"isnull"
});
filter
.
orderConditions
.
push
({
key
:
'saleType'
,
orderSequence
:
'desc'
,
});
}
}
//是否有值来增加筛选项
if
(
condition
.
unit_price
)
{
//单价
filter
.
queryConditions
.
push
(
{
key
:
'referenceAvgPrice'
,
value
:
condition
.
unit_price
.
min
,
operator
:
'greaterEqual'
,
},
{
key
:
'referenceAvgPrice'
,
value
:
condition
.
unit_price
.
max
,
operator
:
'lessEqual'
,
}
);
}
if
(
condition
.
total_price
)
{
//总价
filter
.
queryConditions
.
push
(
{
key
:
'referenceTotalPrice'
,
value
:
condition
.
total_price
.
min
,
operator
:
'greaterEqual'
,
},
{
key
:
'referenceTotalPrice'
,
value
:
condition
.
total_price
.
max
,
operator
:
'lessEqual'
,
}
);
}
if
(
condition
.
area
)
{
//面积
filter
.
queryConditions
.
push
(
{
key
:
'houseArea'
,
value
:
condition
.
area
.
min
,
operator
:
'greaterEqual'
,
},
{
key
:
'houseArea'
,
value
:
condition
.
area
.
max
,
operator
:
'lessEqual'
,
})
;
}
if
(
condition
.
house_type
)
{
//户型
filter
.
queryConditions
.
push
({
key
:
'type'
,
value
:
condition
.
house_type
,
operator
:
'equal'
,
});
}
if
(
condition
.
name
)
{
//关键词搜索 模糊查询
//增加搜索历史
let
addHistory
=
{
type
:
1
,
key_word
:
condition
.
name
};
await
service
.
house
.
searchHistory
.
addSearchHistory
(
addHistory
);
filter
.
queryConditions
.
push
({
key
:
'name'
,
value
:
condition
.
name
,
operator
:
'contains'
,
});
}
if
(
condition
.
area_code
)
{
//城市\区域\商圈筛选
if
(
condition
.
area_code
.
hasOwnProperty
(
'city_code'
)
&&
condition
.
area_code
.
city_code
!==
''
)
{
filter
.
queryConditions
.
push
({
key
:
'city'
,
value
:
condition
.
area_code
.
city_code
,
operator
:
'equal'
,
});
}
if
(
condition
.
area_code
.
hasOwnProperty
(
'district_code'
)
&&
condition
.
area_code
.
district_code
!==
''
)
{
filter
.
queryConditions
.
push
({
key
:
'county'
,
value
:
condition
.
area_code
.
district_code
,
operator
:
'equal'
,
});
}
if
(
condition
.
area_code
.
hasOwnProperty
(
'bizcircle_code'
)
&&
condition
.
area_code
.
bizcircle_code
!==
''
)
{
filter
.
queryConditions
.
push
({
key
:
'region'
,
value
:
condition
.
area_code
.
bizcircle_code
,
operator
:
'equal'
,
});
}
}
let
newHouseList
=
await
service
.
houseCommon
.
newHouse
.
all
(
filter
);
let
list
=
[];
if
(
newHouseList
.
rowCount
>
0
)
{
for
(
let
i
in
newHouseList
.
results
)
{
let
tmp
=
{
id
:
newHouseList
.
results
[
i
].
id
,
name
:
newHouseList
.
results
[
i
].
name
,
address
:
newHouseList
.
results
[
i
].
address
,
tags
:
newHouseList
.
results
[
i
].
tags
.
split
(
','
),
image
:
newHouseList
.
results
[
i
].
image
,
price
:
newHouseList
.
results
[
i
].
referenceAvgPrice
,
};
list
.
push
(
tmp
);
}
}
let
ret
=
{
results
:
list
,
count
:
newHouseList
.
rowCount
};
return
ret
;
}
}
}
module
.
exports
=
NewHouseService
;
module
.
exports
=
NewHouseService
;
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