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
1c7c11b3
Commit
1c7c11b3
authored
Apr 15, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
04244228
Pipeline
#5964
passed with stage
in 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
56 deletions
+72
-56
new_house.js
app/service/house/new_house.js
+72
-56
No files found.
app/service/house/new_house.js
View file @
1c7c11b3
...
...
@@ -103,12 +103,10 @@ class NewHouseService extends Service {
*/
async
formatNewHouse
(
data
)
{
const
{
ctx
,
service
}
=
this
;
ctx
.
logger
.
info
(
data
);
const
saleType
=
{
0
:
'未开售'
,
1
:
'售罄'
,
2
:
'预售'
,
3
:
'在售'
};
const
decorationType
=
{
1
:
'毛坯'
,
2
:
'简装'
,
3
:
'精装'
}
const
archType
=
{
1
:
'板楼'
,
2
:
'塔楼'
};
const
houseType
=
{
1
:
'住宅'
,
2
:
'公寓'
};
let
ret
=
{};
if
(
Object
.
keys
(
data
).
length
>
0
)
{
//开发商整理
...
...
@@ -132,7 +130,7 @@ class NewHouseService extends Service {
open_date
:
data
.
openDate
,
//开盘时间
due_date
:
data
.
dueDate
,
//交房时间
house_area
:
data
.
houseArea
,
//建筑面积
decoration
:
decorationType
[
data
.
decorationType
],
//装修情况,1 毛坯,2简装,3精装
decoration
:
decorationType
[
data
.
decorationType
]
||
''
,
//装修情况,1 毛坯,2简装,3精装
green_ratio
:
data
.
greenRatio
,
//绿化
area_ratio
:
data
.
areaRatio
,
//容积
address
:
data
.
address
,
//地址
...
...
@@ -143,8 +141,8 @@ class NewHouseService extends Service {
tags
:
data
.
tags
.
split
(
','
),
//项目特色
property_type
:
houseType
[
data
.
houseType
],
//物业类型
property_right_years
:
data
.
residential
.
propertyRightYears
,
//产权年限
build_type
:
archType
[
data
.
residential
.
ArchType
]
,
//建筑类型 1 板楼 2塔楼'
decoration
:
decorationType
[
data
.
decorationType
],
//装修情况,1 毛坯,2简装,3精装
build_type
:
archType
[
data
.
residential
.
archType
]
||
''
,
//建筑类型 1 板楼 2塔楼'
decoration
:
decorationType
[
data
.
decorationType
]
||
''
,
//装修情况,1 毛坯,2简装,3精装
},
sale
:
{
sale_type
:
saleType
[
data
.
saleType
],
//销售状态 0未开售,1售罄,2预售,3在售
...
...
@@ -358,73 +356,91 @@ class NewHouseService extends Service {
* 根据不同筛选获取列表
* @param {*} type 四种默认的按钮筛选 全部all 在售sale 最近开盘open 优惠favourable 首页home
*/
async
getNewHouseListByType
(
type
)
{
async
getNewHouseListByType
(
condition
)
{
const
{
ctx
}
=
this
;
let
types
=
[
'all'
,
'sale'
,
'open'
,
'favourable'
,
'home'
];
if
(
!
types
.
includes
(
type
))
{
ctx
.
failed
(
'error list type'
);
if
(
!
condition
.
hasOwnProperty
(
'type'
)
||
!
types
.
includes
(
condition
.
type
))
{
ctx
.
failed
(
'error or empty list type'
);
}
let
type
=
condition
.
type
;
let
page
=
Number
(
condition
.
page
)
||
1
;
let
pageSize
=
Number
(
condition
.
pageSize
)
||
30
;
let
filter
=
{
pageIndex
:
page
,
pageSize
:
pageSize
,
queryConditions
:
[{
key
:
"state"
,
value
:
1
,
operator
:
"equal"
},],
orderConditions
:
[],
}
let
newHouseList
=
[];
let
condition
=
{};
if
(
type
===
'home'
)
{
//为您推荐只展示50条在售楼盘的数据,根据排序序号取数,数字小的排在前面,数字一样的情况下根据时间逆序排列,时间也一样的情况下随机排列;
condition
=
{
pageSize
:
50
,
orderConditions
:
[{
key
:
'orderNum'
,
orderSequence
:
'asc'
,
},
{
filter
.
pageSize
=
50
;
filter
.
orderConditions
.
push
({
key
:
'orderNum'
,
orderSequence
:
'asc'
,
},
{
key
:
'createdAt'
,
orderSequence
:
'desc'
,
},]
};
});
}
else
if
(
type
===
'all'
)
{
condition
=
{
orderConditions
:
[{
key
:
'saleType'
,
orderSequence
:
'desc'
,
},]
};
filter
.
orderConditions
.
push
({
key
:
'saleType'
,
orderSequence
:
'desc'
,
});
}
else
if
(
type
===
'sale'
)
{
//点击在售楼盘进入列表页面且只展示当前销售状态为在售的楼盘
condition
=
{
queryConditions
:
[{
key
:
"saleType"
,
value
:
'3'
,
operator
:
"equal"
}],
};
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'
);
condition
=
{
queryConditions
:
[{
key
:
"openDate"
,
value
:
endDate
,
operator
:
"greater"
}],
orderConditions
:
[{
key
:
'saleType'
,
orderSequence
:
'desc'
,
},]
};
filter
.
queryConditions
.
push
({
key
:
"openDate"
,
value
:
endDate
,
operator
:
"greater"
});
filter
.
orderConditions
.
push
({
key
:
'saleType'
,
orderSequence
:
'desc'
,
})
}
else
if
(
type
===
'favourable'
)
{
//点击优惠好盘只展示有优惠的楼盘,列表单次加载30条楼盘数据,滑到底部再次加载30条
condition
=
{
queryConditions
:
[{
key
:
"favourableInfo"
,
value
:
false
,
operator
:
"isnull"
}],
orderConditions
:
[{
key
:
'saleType'
,
orderSequence
:
'desc'
,
},]
};
filter
.
queryConditions
.
push
({
key
:
"favourableInfo"
,
value
:
false
,
operator
:
"isnull"
});
filter
.
orderConditions
.
push
({
key
:
'saleType'
,
orderSequence
:
'desc'
,
});
}
newHouseList
=
await
this
.
getNewHouseByFilter
(
condition
);
return
newHouseList
;
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
:
list
.
length
};
return
ret
;
}
async
getNewHouseByFilter
(
condition
)
{
...
...
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