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
6fe0ccc1
Commit
6fe0ccc1
authored
Apr 25, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://t-git.51gjj.com/fangbin/51business
parents
c45a76c9
2308b25e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
183 additions
and
7 deletions
+183
-7
new_house.js
app/controller/house/new_house.js
+6
-5
new_house.js
app/service/house/new_house.js
+175
-0
option.js
app/service/house/option.js
+2
-2
No files found.
app/controller/house/new_house.js
View file @
6fe0ccc1
...
...
@@ -24,11 +24,12 @@ class NewHouseController extends Controller {
};
ctx
.
validate
(
rule
,
inputParams
);
let
ret
=
{};
if
(
inputParams
.
hasOwnProperty
(
'type'
)
&&
inputParams
.
type
!==
''
)
{
ret
=
await
ctx
.
service
.
house
.
newHouse
.
getNewHouseListByType
(
inputParams
);
}
else
{
ret
=
await
ctx
.
service
.
house
.
newHouse
.
getNewHouseList
(
inputParams
);
}
// if (inputParams.hasOwnProperty('type') && inputParams.type !== '') {
// ret = await ctx.service.house.newHouse.getNewHouseListByType(inputParams);
// } else {
// ret = await ctx.service.house.newHouse.getNewHouseList(inputParams);
// }
ret
=
await
ctx
.
service
.
house
.
newHouse
.
getNewHouseListV2
(
inputParams
);
ctx
.
success
(
ret
);
}
...
...
app/service/house/new_house.js
View file @
6fe0ccc1
...
...
@@ -479,6 +479,181 @@ class NewHouseService extends Service {
return
ret
;
}
async
getNewHouseListV2
(
condition
)
{
const
{
ctx
,
service
}
=
this
;
let
types
=
[
'all'
,
'sale'
,
'open'
,
'favourable'
,
'home'
];
let
type
=
(
condition
.
hasOwnProperty
(
'type'
)
&&
types
.
includes
(
condition
.
type
))
?
condition
.
type
:
''
;
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
(
condition
.
hasOwnProperty
(
'type'
)
&&
condition
.
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
;
app/service/house/option.js
View file @
6fe0ccc1
...
...
@@ -34,7 +34,7 @@ const NEW_HOUSE_UNIT_PRICE = [
{
name
:
'2万-3万'
,
id
:
-
121
,
min
:
20000
,
max
:
30000
},
{
name
:
'3万-4万'
,
id
:
-
122
,
min
:
30000
,
max
:
40000
},
{
name
:
'4万-5万'
,
id
:
-
123
,
min
:
40000
,
max
:
50000
},
{
name
:
'5万-6万'
,
id
:
-
124
,
min
:
60000
,
max
:
7
0000
},
{
name
:
'5万-6万'
,
id
:
-
124
,
min
:
50000
,
max
:
6
0000
},
]
const
NEW_HOUSE_TOTAL_PRICE
=
[
...
...
@@ -49,7 +49,7 @@ const NEW_HOUSE_TOTAL_PRICE = [
{
name
:
'700万-800万'
,
id
:
-
133
,
min
:
700
,
max
:
800
},
{
name
:
'800万-900万'
,
id
:
-
134
,
min
:
800
,
max
:
900
},
{
name
:
'900万-1000万'
,
id
:
-
135
,
min
:
900
,
max
:
1000
},
{
name
:
'1000万以上'
,
id
:
-
136
,
min
:
1000
,
max
:
0
},
{
name
:
'1000万以上'
,
id
:
-
136
,
min
:
1000
,
max
:
999999999
},
]
const
NEW_HOUSE_AREA
=
[
...
...
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