Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
0c28c244
Commit
0c28c244
authored
Jun 20, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
6cc8dfe3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
186 additions
and
127 deletions
+186
-127
OfficeRoomService.php
application/index/service/OfficeRoomService.php
+178
-127
OfficeGBuildingStations.php
application/model/OfficeGBuildingStations.php
+8
-0
No files found.
application/index/service/OfficeRoomService.php
View file @
0c28c244
...
...
@@ -56,8 +56,8 @@ class OfficeRoomService
$this
->
m_office
=
new
OfficeGBuilding
();
if
(
CURRENT_URL
==
'https://api.tonglianjituan.com/'
)
{
$this
->
internet_path
=
IMAGES_URL
.
'/resource/lib/Attachments/images/'
;
}
else
{
$this
->
internet_path
=
IMAGES_URL
.
'/resource/lib/Attachments/images/'
;
}
else
{
$this
->
internet_path
=
'http://pre2.tonglianjituan.com/resource/lib/Attachments/images/'
;
}
}
...
...
@@ -89,7 +89,7 @@ class OfficeRoomService
$result
[
'msg'
]
=
$this
->
validate
->
getError
();
return
$result
;
}
$status
=
$this
->
m_office
->
getFieldOneValue
(
'status'
,
[
'id'
=>
$data
[
'building_id'
]]);
//验证办公楼字典是否完整
$status
=
$this
->
m_office
->
getFieldOneValue
(
'status'
,
[
'id'
=>
$data
[
'building_id'
]]);
//验证办公楼字典是否完整
$is_alert
=
0
;
if
(
$status
!=
1
)
{
$is_alert
=
1
;
...
...
@@ -110,10 +110,10 @@ class OfficeRoomService
$landlord_phone_old
=
$this
->
landlordPhoneEditV2
(
$landlord_phone_new
,
$id
);
if
(
!
empty
(
$landlord_phone_old
))
{
$remark
.=
implode
(
','
,
$landlord_phone_old
)
.
','
;
$remark
.=
implode
(
','
,
$landlord_phone_old
)
.
','
;
}
}
catch
(
\Exception
$e
)
{
$result
[
'msg'
]
=
'房东手机号处理失败'
.
$e
->
getMessage
();
$result
[
'msg'
]
=
'房东手机号处理失败'
.
$e
->
getMessage
();
return
$result
;
}
}
...
...
@@ -261,7 +261,7 @@ class OfficeRoomService
if
(
$data
)
{
/*案场,盘方,独家 start*/
$agents_data
=
$this
->
agent_room
->
getAgentsByRoomId
(
'b.id,name,a.type,b.phone'
,
[
'house_id'
=>
$data
[
'id'
]]);
$agents_data
=
$this
->
agent_room
->
getAgentsByRoomId
(
'b.id,name,a.type,b.phone'
,
[
'house_id'
=>
$data
[
'id'
]]);
$agents_str
=
$exclusive_str
=
$dish_str
=
''
;
foreach
(
$agents_data
as
$k
=>
$v
)
{
if
(
$v
[
'type'
]
==
1
)
{
...
...
@@ -296,7 +296,7 @@ class OfficeRoomService
/*案场,盘方,独家 end*/
/*图片 start*/
$img_data
=
$this
->
m_office_img
->
getListAll
(
'id,img_type,img_name'
,
[
'house_id'
=>
$id
]);
$img_data
=
$this
->
m_office_img
->
getListAll
(
'id,img_type,img_name'
,
[
'house_id'
=>
$id
]);
if
(
$app
==
0
)
{
foreach
(
$img_data
as
$k
=>
$v
)
{
...
...
@@ -346,11 +346,11 @@ class OfficeRoomService
$data
[
'title'
]
=
''
;
$data
[
'landlord_phone_array'
]
=
$data
[
'building_data'
]
=
[];
}
else
{
$data
[
'title'
]
=
$office
->
getFieldOneValue
(
'title'
,
[
'id'
=>
$data
[
'building_id'
]]);
$data
[
'landlord_phone_array'
]
=
$m_landlord
->
getAllList
(
'id,name,phone'
,
[
'house_id'
=>
$data
[
'id'
]]);
$data
[
'title'
]
=
$office
->
getFieldOneValue
(
'title'
,
[
'id'
=>
$data
[
'building_id'
]]);
$data
[
'landlord_phone_array'
]
=
$m_landlord
->
getAllList
(
'id,name,phone'
,
[
'house_id'
=>
$data
[
'id'
]]);
$building_service
=
new
OfficeService
();
$building_data
=
$building_service
->
BuildingSearch
(
1
,
100
,
[
'id'
=>
$data
[
'building_id'
]]);
$building_data
=
$building_service
->
BuildingSearch
(
1
,
100
,
[
'id'
=>
$data
[
'building_id'
]]);
if
(
$building_data
[
'status'
]
!=
'fail'
)
{
$data
[
'building_data'
]
=
$building_data
[
'data'
][
0
];
}
else
{
...
...
@@ -358,22 +358,22 @@ class OfficeRoomService
}
}
$data
[
'landlord_phone_array'
]
=
$this
->
landlord_phone
->
getAllList
(
'id,name,phone'
,
[
'house_id'
=>
$id
]);
//房东手机号
$data
[
'landlord_phone_array'
]
=
$this
->
landlord_phone
->
getAllList
(
'id,name,phone'
,
[
'house_id'
=>
$id
]);
//房东手机号
if
(
$data
[
'price_total'
]
>
0
)
{
$data
[
'price_total'
]
=
$data
[
'price_total'
]
/
100
;
$data
[
'price_total'
]
=
$data
[
'price_total'
]
/
100
;
}
if
(
$data
[
'price'
]
>
0
)
{
$data
[
'price'
]
=
$data
[
'price'
]
/
100
;
$data
[
'price'
]
=
$data
[
'price'
]
/
100
;
}
if
(
$data
[
'slotting_fee'
]
>
0
)
{
$data
[
'slotting_fee'
]
=
$data
[
'slotting_fee'
]
/
100
;
$data
[
'slotting_fee'
]
=
$data
[
'slotting_fee'
]
/
100
;
}
if
(
$data
[
'management_fee'
]
>
0
)
{
$data
[
'management_fee'
]
=
$data
[
'management_fee'
]
/
100
;
$data
[
'management_fee'
]
=
$data
[
'management_fee'
]
/
100
;
}
}
$result
[
'data'
]
=
$data
;
...
...
@@ -513,7 +513,7 @@ class OfficeRoomService
}
}
$result
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$e
->
getMessage
();
}
...
...
@@ -532,21 +532,22 @@ class OfficeRoomService
* User HuJun
* Date 19-5-30 下午9:01
*/
public
function
delAgentHouse
(
$type
,
$house_id
,
$id_edit
=
1
)
{
public
function
delAgentHouse
(
$type
,
$house_id
,
$id_edit
=
1
)
{
if
(
empty
(
$type
)
||
empty
(
$house_id
))
{
return
false
;
}
$id
=
$this
->
m_office_room
->
getTotal
([
'id'
=>
$house_id
,
'is_exclusive_type'
=>
1
]);
$id
=
$this
->
m_office_room
->
getTotal
([
'id'
=>
$house_id
,
'is_exclusive_type'
=>
1
]);
if
(
empty
(
$id
))
{
return
false
;
}
$where
[
'house_id'
]
=
$house_id
;
$where
[
'type'
]
=
$type
;
$is_ok
=
$this
->
agent_room
->
updateData
([
'is_del'
=>
1
],
$where
);
$is_ok
=
$this
->
agent_room
->
updateData
([
'is_del'
=>
1
],
$where
);
if
(
$id_edit
&&
$type
==
3
)
{
$this
->
m_office_room
->
editData
([
'is_exclusive_type'
=>
0
],
$house_id
);
$this
->
m_office_room
->
editData
([
'is_exclusive_type'
=>
0
],
$house_id
);
}
return
$is_ok
;
}
...
...
@@ -561,23 +562,24 @@ class OfficeRoomService
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public
function
landlordPhoneEditV2
(
array
$data
,
$house_id
)
{
public
function
landlordPhoneEditV2
(
array
$data
,
$house_id
)
{
$update_data
=
$insert_data
=
$new_phone
=
$del_phone
=
$edit_phone
=
[];
$key
=
0
;
$old_landlord
=
$this
->
landlord_phone
->
getColumn
(
'id,phone'
,
[
'house_id'
=>
$house_id
]);
$old_landlord
=
$this
->
landlord_phone
->
getColumn
(
'id,phone'
,
[
'house_id'
=>
$house_id
]);
if
(
empty
(
$old_landlord
))
{
//新增
foreach
(
$data
as
$k
=>
$v
)
{
foreach
(
$data
as
$k
=>
$v
)
{
$insert_data
[
$k
][
'name'
]
=
$v
[
'name'
];
$insert_data
[
$k
][
'phone'
]
=
$v
[
'phone'
];
$insert_data
[
$k
][
'house_id'
]
=
$house_id
;
$edit_phone
[]
=
'新增房东手机号:'
.
substr_replace
(
$v
[
'phone'
],
'****'
,
3
,
4
);
$edit_phone
[]
=
'新增房东手机号:'
.
substr_replace
(
$v
[
'phone'
],
'****'
,
3
,
4
);
}
}
else
{
//新增与编辑
foreach
(
$data
as
$k
=>
$v
)
{
foreach
(
$data
as
$k
=>
$v
)
{
if
(
$v
[
'id'
])
{
$phone
=
$old_landlord
[
$v
[
'id'
]];
...
...
@@ -586,7 +588,7 @@ class OfficeRoomService
$update_data
[
$key
][
'name'
]
=
$v
[
'name'
];
if
(
$phone
!=
$v
[
'phone'
])
{
$update_data
[
$k
][
'phone'
]
=
$v
[
'phone'
];
$edit_phone
[]
=
'房东手机号由【'
.
substr_replace
(
$phone
,
'****'
,
3
,
4
)
.
'】修改为【'
.
substr_replace
(
$v
[
'phone'
],
'****'
,
3
,
4
)
.
'】'
;
$edit_phone
[]
=
'房东手机号由【'
.
substr_replace
(
$phone
,
'****'
,
3
,
4
)
.
'】修改为【'
.
substr_replace
(
$v
[
'phone'
],
'****'
,
3
,
4
)
.
'】'
;
$new_phone
[]
=
$phone
;
}
}
...
...
@@ -602,12 +604,12 @@ class OfficeRoomService
$key
++
;
}
foreach
(
$old_landlord
as
$k2
=>
$v2
)
{
foreach
(
$old_landlord
as
$k2
=>
$v2
)
{
if
(
!
in_array
(
$v2
,
$new_phone
))
{
$update_data
[
$key
][
'id'
]
=
$k2
;
$update_data
[
$key
][
'is_del'
]
=
1
;
$key
++
;
$edit_phone
[]
=
'删除房东手机号:'
.
substr_replace
(
$v2
,
'****'
,
3
,
4
)
;
$edit_phone
[]
=
'删除房东手机号:'
.
substr_replace
(
$v2
,
'****'
,
3
,
4
)
;
}
}
}
...
...
@@ -628,7 +630,8 @@ class OfficeRoomService
* @return array
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=867
*/
public
function
getOfficeRoomInfo
(
$id
,
$agent_id
){
public
function
getOfficeRoomInfo
(
$id
,
$agent_id
)
{
$field
=
'a.id,a.building_id,b.title,b.province,b.city,b.disc,b.floor_total,a.price_total,a.price,a.station_start,b.type,a.station_end,a.area,a.floor,a.floor_tag,
a.is_register,a.age_limit_start,a.age_limit_end,a.rent_free,a.management_fee,a.slotting_fee,a.carport,a.enter_date,
...
...
@@ -636,9 +639,9 @@ class OfficeRoomService
a.fee_rule,a.update_time,b.address,a.is_exclusive_type,a.agent_start_time,a.agent_end_time,c.name as business_name,
a.shop_sign,b.longitude,b.latitude,b.intro,a.is_rent,a.room_number,a.is_show,a.mansion'
;
$result
=
$this
->
m_office_room
->
getOfficeRoomInfo
(
$field
,
[
'a.id'
=>
$id
]);
$result
=
$this
->
m_office_room
->
getOfficeRoomInfo
(
$field
,
[
'a.id'
=>
$id
]);
if
(
!
$result
)
{
return
[
'status'
=>
101
,
'msg'
=>
'此房源不存在'
,
'data'
=>
''
];
return
[
'status'
=>
101
,
'msg'
=>
'此房源不存在'
,
'data'
=>
''
];
}
$result
[
'price'
]
=
$result
[
'price'
]
*
0.01
;
...
...
@@ -647,13 +650,13 @@ class OfficeRoomService
$result
[
'management_fee'
]
=
$result
[
'management_fee'
]
*
0.01
;
//轮播图
$result
[
'carousel_image'
]
=
$this
->
getCarouselImage
(
$result
[
'id'
],
2
);
$result
[
'carousel_image'
]
=
$this
->
getCarouselImage
(
$result
[
'id'
],
2
);
//上传人
$result
[
'upload_info'
]
=
$this
->
getUploadInfo
(
$result
[
'operation_id'
]);
//独家方
$result
[
'exclusive_info'
]
=
$this
->
getExclusiveInfo
(
$result
[
'id'
],
3
);
$result
[
'exclusive_info'
]
=
$this
->
getExclusiveInfo
(
$result
[
'id'
],
3
);
//盘方
$result
[
'room_relegation_info'
]
=
$this
->
getExclusiveInfo
(
$result
[
'id'
],
2
);
$result
[
'room_relegation_info'
]
=
$this
->
getExclusiveInfo
(
$result
[
'id'
],
2
);
//房东
$result
[
'landlord_info'
]
=
$this
->
getLandlordInfo
(
$result
[
'id'
]);
//房源数
...
...
@@ -665,31 +668,32 @@ class OfficeRoomService
//楼盘图
$result
[
'building_image'
]
=
$this
->
getBuildingImage
(
$result
[
'building_id'
]);
//是否被收藏
$result
[
'is_collect'
]
=
$this
->
isCollect
(
$result
[
'id'
],
$agent_id
);
$result
[
'is_collect'
]
=
$this
->
isCollect
(
$result
[
'id'
],
$agent_id
);
//是否可编辑
$result
[
'is_can_edit'
]
=
$this
->
isCanEdit
(
$result
[
'id'
],
$agent_id
);
$result
[
'is_can_edit'
]
=
$this
->
isCanEdit
(
$result
[
'id'
],
$agent_id
);
return
[
'status'
=>
200
,
'msg'
=>
'success'
,
'data'
=>
$result
];
return
[
'status'
=>
200
,
'msg'
=>
'success'
,
'data'
=>
$result
];
}
//是否可编辑
public
function
isCanEdit
(
$id
,
$agent_id
){
public
function
isCanEdit
(
$id
,
$agent_id
)
{
$params
[
'house_id'
]
=
$id
;
$params
[
'agent_id'
]
=
$agent_id
;
$params
[
'type'
]
=
2
;
$house
=
$this
->
agent_room
->
isCanEdit
(
'agent_id'
,
$params
);
if
(
$house
)
{
if
(
$house
)
{
return
0
;
}
else
{
}
else
{
return
1
;
}
}
//是否被收藏
private
function
isCollect
(
$house_id
,
$agent_id
){
private
function
isCollect
(
$house_id
,
$agent_id
)
{
$m_collect_room
=
new
OfficeACollectHouse
();
//是否被收藏
$is_collect
=
2
;
...
...
@@ -707,7 +711,8 @@ class OfficeRoomService
}
//参考均价
public
function
referenceAveragePrice
(
$id
){
public
function
referenceAveragePrice
(
$id
)
{
$field
=
'MIN(price) as num'
;
$where
[
'building_id'
]
=
$id
;
$where
[
'status'
]
=
1
;
...
...
@@ -717,50 +722,55 @@ class OfficeRoomService
}
//字段最低值
public
function
MinField
(
$id
,
$field
=
''
){
public
function
MinField
(
$id
,
$field
=
''
)
{
$where
[
'building_id'
]
=
$id
;
$field_string
=
"min(
{
$field
}
) as min"
;
return
$this
->
m_office_room
->
getFieldOneValue
(
$field_string
,
$where
);
}
//楼盘图
public
function
getBuildingImage
(
$id
){
public
function
getBuildingImage
(
$id
)
{
$where
[
'img_status'
]
=
0
;
$where
[
'house_id'
]
=
$id
;
$where
[
'img_type'
]
=
0
;
$house_img_data
=
$this
->
m_office_img
->
getListAll
(
'id,img_name'
,
$where
);
if
(
$house_img_data
)
{
foreach
(
$house_img_data
as
$k
=>
$v
)
{
$house_img_data
[
$k
][
'image_path'
]
=
$this
->
internet_path
.
$v
[
'img_name'
];
if
(
$house_img_data
)
{
foreach
(
$house_img_data
as
$k
=>
$v
)
{
$house_img_data
[
$k
][
'image_path'
]
=
$this
->
internet_path
.
$v
[
'img_name'
];
}
}
return
$house_img_data
;
}
//轮播图
public
function
getCarouselImage
(
$id
,
$img_type
=
2
){
public
function
getCarouselImage
(
$id
,
$img_type
=
2
)
{
$where
[
'img_type'
]
=
$img_type
;
$where
[
'img_status'
]
=
0
;
$where
[
'house_id'
]
=
$id
;
$house_img_data
=
$this
->
m_office_img
->
getListAll
(
'id,img_name'
,
$where
);
if
(
$house_img_data
)
{
foreach
(
$house_img_data
as
$k
=>
$v
)
{
$house_img_data
[
$k
][
'image_path'
]
=
$this
->
internet_path
.
$v
[
'img_name'
];
if
(
$house_img_data
)
{
foreach
(
$house_img_data
as
$k
=>
$v
)
{
$house_img_data
[
$k
][
'image_path'
]
=
$this
->
internet_path
.
$v
[
'img_name'
];
}
}
return
$house_img_data
?
$house_img_data
:
[];
return
$house_img_data
?
$house_img_data
:
[];
}
//交通信息
public
function
getTrafficInfo
(
$id
){
public
function
getTrafficInfo
(
$id
)
{
$field
=
'b.line_name_simple,b.name,a.distance'
;
$res
=
$this
->
m_building_stations
->
getTrafficInfo
(
$field
,
[
'a.building_id'
=>
$id
]);
$res
=
$this
->
m_building_stations
->
getTrafficInfo
(
$field
,
[
'a.building_id'
=>
$id
]);
$res_str
=
"
{
$res
[
'line_name_simple'
]
}{
$res
[
'name'
]
}
地铁站出站
{
$res
[
'distance'
]
}
米"
;
return
$res_str
;
}
//房源数
public
function
getRoomNum
(
$building_id
){
public
function
getRoomNum
(
$building_id
)
{
$params
[
'building_id'
]
=
$building_id
;
// $params['id'] = array('neq',$id);
$params
[
'is_rent'
]
=
0
;
...
...
@@ -770,24 +780,26 @@ class OfficeRoomService
}
//获取上传人信息
public
function
getUploadInfo
(
$agent_id
){
public
function
getUploadInfo
(
$agent_id
)
{
$agent
=
[];
$res
=
$this
->
redis_service
->
getRedisCache
(
2
,
$agent_id
);
if
(
$res
)
{
if
(
$res
)
{
$agent
[
'name'
]
=
$res
[
'name'
];
$agent
[
'phone'
]
=
$res
[
'phone'
];
}
return
$agent
?
$agent
:
null
;
return
$agent
?
$agent
:
null
;
}
//获取独家方
public
function
getExclusiveInfo
(
$house_id
,
$type
=
3
){
public
function
getExclusiveInfo
(
$house_id
,
$type
=
3
)
{
$exclusive_info
=
[];
$params
[
'house_id'
]
=
$house_id
;
$params
[
'type'
]
=
$type
;
$params
[
'is_del'
]
=
0
;
$res
=
$this
->
agent_room
->
getAgentsByRoomId
(
'b.id,name,a.type,b.phone'
,
$params
);
if
(
$res
)
{
if
(
$res
)
{
$exclusive_info
[
'name'
]
=
$res
[
0
][
'name'
];
$exclusive_info
[
'phone'
]
=
$res
[
0
][
'phone'
];
}
...
...
@@ -796,12 +808,13 @@ class OfficeRoomService
//房东
public
function
getLandlordInfo
(
$house_id
){
public
function
getLandlordInfo
(
$house_id
)
{
$m_landlord
=
new
OfficeGLandlordPhone
();
$res
=
$m_landlord
->
getAllList
(
'id,name,phone'
,
[
'house_id'
=>
$house_id
]);;
if
(
$res
)
{
foreach
(
$res
as
$k
=>
$v
)
{
$res
=
$m_landlord
->
getAllList
(
'id,name,phone'
,
[
'house_id'
=>
$house_id
]);;
if
(
$res
)
{
foreach
(
$res
as
$k
=>
$v
)
{
$res
[
$k
][
'phone'
]
=
preg_replace
(
'/(\d{3})\d{4}(\d{4})/'
,
'$1****$2'
,
$v
[
"phone"
]);
}
}
...
...
@@ -817,7 +830,8 @@ class OfficeRoomService
* User HuJun
* Date 19-6-3 上午10:31
*/
public
function
getRoomList
(
$params
,
$is_total
=
0
)
{
public
function
getRoomList
(
$params
,
$is_total
=
0
)
{
$page_no
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$page_size
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$result
[
'status'
]
=
'fail'
;
...
...
@@ -862,16 +876,16 @@ class OfficeRoomService
$result
[
'msg'
]
=
'房东手机不足11位'
;
return
$result
;
}
$landlord_where
[
'phone'
]
=
[
'LIKE'
,
'%'
.
$params
[
'landlord_phone'
]
.
'%'
];
$landlord_where
[
'phone'
]
=
[
'LIKE'
,
'%'
.
$params
[
'landlord_phone'
]
.
'%'
];
$landlord_where
[
'is_del'
]
=
0
;
$landlord_arr
=
$this
->
landlord_phone
->
getList
(
1
,
1000
,
''
,
'house_id'
,
$landlord_where
);
$landlord_arr
=
$this
->
landlord_phone
->
getList
(
1
,
1000
,
''
,
'house_id'
,
$landlord_where
);
if
(
empty
(
$landlord_arr
))
{
$result
[
'status'
]
=
'successful'
;
return
$result
;
}
else
{
$landlord_house_id
=
[];
foreach
(
$landlord_arr
as
$k
=>
$v
)
{
foreach
(
$landlord_arr
as
$k
=>
$v
)
{
$landlord_house_id
[]
=
$v
[
'house_id'
];
}
$landlord_str
=
implode
(
','
,
$landlord_house_id
);
...
...
@@ -884,12 +898,12 @@ class OfficeRoomService
$room_data
=
$this
->
m_office_room
->
getRoomAgent
(
$page_no
,
$page_size
,
$field
,
$where
);
$m_business
=
new
GBusinessDistrict
();
foreach
(
$room_data
as
$k
=>
$v
)
{
$room_data
[
$k
][
'business_name'
]
=
$m_business
->
getValue
([
'id'
=>
$v
[
'business_district_id'
]],
'name'
);
$room_data
[
$k
][
'price_total'
]
=
$room_data
[
$k
][
'price_total'
]
/
100
;
$room_data
[
$k
][
'price'
]
=
$room_data
[
$k
][
'price'
]
/
100
;
foreach
(
$room_data
as
$k
=>
$v
)
{
$room_data
[
$k
][
'business_name'
]
=
$m_business
->
getValue
([
'id'
=>
$v
[
'business_district_id'
]],
'name'
);
$room_data
[
$k
][
'price_total'
]
=
$room_data
[
$k
][
'price_total'
]
/
100
;
$room_data
[
$k
][
'price'
]
=
$room_data
[
$k
][
'price'
]
/
100
;
$dish_name
=
$this
->
agent_room
->
getAgentsByRoomColumn
(
'b.name'
,
[
'a.house_id'
=>
$v
[
'id'
],
'a.type'
=>
2
]);
$dish_name
=
$this
->
agent_room
->
getAgentsByRoomColumn
(
'b.name'
,
[
'a.house_id'
=>
$v
[
'id'
],
'a.type'
=>
2
]);
if
(
empty
(
$dish_name
))
{
$room_data
[
$k
][
'dish_name'
]
=
''
;
}
else
{
...
...
@@ -902,7 +916,7 @@ class OfficeRoomService
}
$result
[
'data'
]
=
$room_data
;
$result
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
$result
[
'msg'
]
=
$e
->
getMessage
();
}
...
...
@@ -917,7 +931,8 @@ class OfficeRoomService
* User HuJun
* Date 19-6-2 下午4:21
*/
private
function
buildParams
(
$params
)
{
private
function
buildParams
(
$params
)
{
$where
=
[];
/*所在区*/
if
(
isset
(
$params
[
'disc'
]))
{
...
...
@@ -963,32 +978,32 @@ class OfficeRoomService
/*租金总价*/
if
(
isset
(
$params
[
'price_total_start'
]))
{
$where
[
'a.price_total'
]
=
$params
[
'price_total_start'
]
*
100
;
$where
[
'a.price_total'
]
=
$params
[
'price_total_start'
]
*
100
;
}
/*租金总价*/
if
(
isset
(
$params
[
'price_total_end'
]))
{
$where
[
'a.price_total'
]
=
$params
[
'price_total_end'
]
*
100
;
$where
[
'a.price_total'
]
=
$params
[
'price_total_end'
]
*
100
;
}
/*租金总价*/
if
(
isset
(
$params
[
'price_total_end'
])
&&
isset
(
$params
[
'price_total_start'
]))
{
$where
[
'a.price_total'
]
=
[
'between'
,
[
$params
[
'price_total_start'
]
*
100
,
$params
[
'price_total_end'
]
*
100
]];
$where
[
'a.price_total'
]
=
[
'between'
,
[
$params
[
'price_total_start'
]
*
100
,
$params
[
'price_total_end'
]
*
100
]];
}
/*租金单价*/
if
(
isset
(
$params
[
'price_start'
]))
{
$where
[
'a.price'
]
=
$params
[
'price_start'
]
*
100
;
$where
[
'a.price'
]
=
$params
[
'price_start'
]
*
100
;
}
/*租金单价*/
if
(
isset
(
$params
[
'price_end'
]))
{
$where
[
'a.price'
]
=
$params
[
'price_end'
]
*
100
;
$where
[
'a.price'
]
=
$params
[
'price_end'
]
*
100
;
}
/*租金单价*/
if
(
isset
(
$params
[
'price_end'
])
&&
isset
(
$params
[
'price_start'
]))
{
$where
[
'a.price'
]
=
[
'between'
,
[
$params
[
'price_start'
]
*
100
,
$params
[
'price_end'
]
*
100
]];
$where
[
'a.price'
]
=
[
'between'
,
[
$params
[
'price_start'
]
*
100
,
$params
[
'price_end'
]
*
100
]];
}
/*可容纳工位*/
...
...
@@ -1003,8 +1018,8 @@ class OfficeRoomService
/*可容纳工位*/
if
(
isset
(
$params
[
'station_end'
])
&&
isset
(
$params
[
'station_start'
]))
{
$where
[
'a.station_start'
]
=
[
'between'
,
[
$params
[
'station_start'
],
$params
[
'station_end'
]]];
$where
[
'a.station_end'
]
=
[
'between'
,
[
$params
[
'station_start'
],
$params
[
'station_end'
]]];
$where
[
'a.station_start'
]
=
[
'between'
,
[
$params
[
'station_start'
],
$params
[
'station_end'
]]];
$where
[
'a.station_end'
]
=
[
'between'
,
[
$params
[
'station_start'
],
$params
[
'station_end'
]]];
}
//编号
...
...
@@ -1014,7 +1029,7 @@ class OfficeRoomService
//地址
if
(
isset
(
$params
[
'address'
]))
{
$where
[
'b.address'
]
=
[
'like'
,
'%'
.
$params
[
'address'
]
.
'%'
];
$where
[
'b.address'
]
=
[
'like'
,
'%'
.
$params
[
'address'
]
.
'%'
];
}
//是否独家0否1是
...
...
@@ -1139,31 +1154,32 @@ class OfficeRoomService
* @param $agentId
* @return array
*/
public
function
getMyBuildingRoom
(
$status
,
$pageNo
,
$pageSize
,
$agentId
){
public
function
getMyBuildingRoom
(
$status
,
$pageNo
,
$pageSize
,
$agentId
)
{
$field
=
"a.id,a.building_id,a.area,a.price_total,a.price,a.station_start,a.station_end,
a.decoration,b.disc,b.title,d.name as business_name,a.status"
;
$params
[
"a.status"
]
=
$status
;
$params
[
"c.agent_id"
]
=
$agentId
;
$params
[
"c.type"
]
=
2
;
$params
[
"c.is_del"
]
=
0
;
$res
=
$this
->
m_office_room
->
getMyBuildingRoom
(
$field
,
$params
,
$pageSize
,
$pageNo
);
$res
=
$this
->
m_office_room
->
getMyBuildingRoom
(
$field
,
$params
,
$pageSize
,
$pageNo
);
if
(
!
$res
)
{
return
[
'status'
=>
200
,
'msg'
=>
'此房源不存在'
,
'data'
=>
[]];
return
[
'status'
=>
200
,
'msg'
=>
'此房源不存在'
,
'data'
=>
[]];
}
foreach
(
$res
as
$k
=>
$v
)
{
foreach
(
$res
as
$k
=>
$v
)
{
$tmp
[
'id'
]
=
$v
[
'id'
];
$tmp
[
'status'
]
=
$v
[
'status'
];
$tmp
[
'price'
]
=
$this
->
MinField
(
$v
[
'building_id'
],
'price'
);
$tmp
[
'price'
]
=
empty
(
$tmp
[
'price'
])
?
0
:
$tmp
[
'price'
]
/
100
;
$tmp
[
'price'
]
=
empty
(
$tmp
[
'price'
])
?
0
:
$tmp
[
'price'
]
/
100
;
$tmp
[
'price_total'
]
=
$this
->
MinField
(
$v
[
'building_id'
],
'price_total'
);
$tmp
[
'price_total'
]
=
empty
(
$tmp
[
'price_total'
])
?
0
:
$tmp
[
'price_total'
]
/
100
;
$tmp
[
'price_total'
]
=
empty
(
$tmp
[
'price_total'
])
?
0
:
$tmp
[
'price_total'
]
/
100
;
$tmp
[
'shop_sign'
]
=
$this
->
getBuildingSign
(
$v
[
'id'
]);
$area
=
$this
->
MinField
(
$v
[
'building_id'
],
'area'
);
$tmp
[
'title'
]
=
$v
[
'disc'
]
.
' '
.
$v
[
'business_name'
]
.
' '
.
$v
[
'title'
]
.
' '
.
$area
.
'㎡'
;
$tmp
[
'title'
]
=
$v
[
'disc'
]
.
' '
.
$v
[
'business_name'
]
.
' '
.
$v
[
'title'
]
.
' '
.
$area
.
'㎡'
;
$result_data
[]
=
$tmp
;
}
return
[
'status'
=>
200
,
'msg'
=>
'success'
,
'data'
=>
$result_data
];
return
[
'status'
=>
200
,
'msg'
=>
'success'
,
'data'
=>
$result_data
];
}
/**
...
...
@@ -1188,7 +1204,7 @@ class OfficeRoomService
}
if
(
isset
(
$params
[
'title'
]))
{
$where
[
'b.title'
]
=
[
'LIKE'
,
'%'
.
$params
[
'title'
]
.
'%'
];
//楼盘名
$where
[
'b.title'
]
=
[
'LIKE'
,
'%'
.
$params
[
'title'
]
.
'%'
];
//楼盘名
}
if
(
isset
(
$params
[
'id'
]))
{
...
...
@@ -1216,15 +1232,15 @@ class OfficeRoomService
}
if
(
isset
(
$params
[
'price_start'
]))
{
$where
[
'a.price'
]
=
$params
[
'price_start'
]
*
100
;
//租金单价
$where
[
'a.price'
]
=
$params
[
'price_start'
]
*
100
;
//租金单价
}
if
(
isset
(
$params
[
'price_end'
]))
{
$where
[
'a.price'
]
=
$params
[
'price_end'
]
*
100
;
//租金单价
$where
[
'a.price'
]
=
$params
[
'price_end'
]
*
100
;
//租金单价
}
if
(
isset
(
$params
[
'price_start'
])
&&
isset
(
$params
[
'price_end'
]))
{
$where
[
'a.price'
]
=
[
'between'
,
[
$params
[
'price_start'
]
*
100
,
$params
[
'price_end'
]
*
100
]];
//租金单价
$where
[
'a.price'
]
=
[
'between'
,
[
$params
[
'price_start'
]
*
100
,
$params
[
'price_end'
]
*
100
]];
//租金单价
}
if
(
isset
(
$params
[
'is_exclusive_type'
]))
{
...
...
@@ -1245,13 +1261,19 @@ class OfficeRoomService
}
if
(
isset
(
$params
[
'shop_sign'
]))
{
$where
[
'a.shop_sign'
]
=
[
'like'
,
'%'
.
$params
[
'shop_sign'
]
.
'%'
];
//商铺标签
$where
[
'a.shop_sign'
]
=
[
'like'
,
'%'
.
$params
[
'shop_sign'
]
.
'%'
];
//商铺标签
}
if
(
isset
(
$params
[
'is_carefully_chosen'
]))
{
$where
[
'a.is_carefully_chosen'
]
=
$params
[
'is_carefully_chosen'
];
//精选商铺--0否1是
$order
=
'a.home_page_sort desc'
;
}
if
(
isset
(
$params
[
'stations_ids'
])){
$ids
=
$this
->
getBuildingByStations
(
$params
[
'stations_ids'
]);
if
(
$ids
){
$where
[
'b.id'
]
=
array
(
"in"
,
$ids
);
//地铁
}
}
$field
=
'a.id,b.disc,b.title,b.address,c.name as business_name,a.building_id,a.price,a.price_total,b.status,a.is_rent'
;
try
{
...
...
@@ -1263,15 +1285,15 @@ class OfficeRoomService
}
$result_data
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
foreach
(
$data
as
$k
=>
$v
)
{
$tmp
[
'id'
]
=
$v
[
'id'
];
$tmp
[
'price'
]
=
empty
(
$v
[
'price'
])
?
0
:
$v
[
'price'
]
/
100
;
$tmp
[
'price_total'
]
=
empty
(
$v
[
'price_total'
])
?
0
:
$v
[
'price_total'
]
/
100
;
$tmp
[
'price'
]
=
empty
(
$v
[
'price'
])
?
0
:
$v
[
'price'
]
/
100
;
$tmp
[
'price_total'
]
=
empty
(
$v
[
'price_total'
])
?
0
:
$v
[
'price_total'
]
/
100
;
$tmp
[
'shop_sign'
]
=
$this
->
getBuildingSign
(
$v
[
'building_id'
]);
$tmp
[
'status'
]
=
$v
[
'status'
];
$tmp
[
'is_rent'
]
=
$v
[
'is_rent'
];
$area
=
$this
->
MinField
(
$v
[
'building_id'
],
'area'
);
$tmp
[
'title'
]
=
$v
[
'disc'
]
.
' '
.
$v
[
'business_name'
]
.
' '
.
$v
[
'title'
]
.
' '
.
$area
.
'㎡'
;
$tmp
[
'title'
]
=
$v
[
'disc'
]
.
' '
.
$v
[
'business_name'
]
.
' '
.
$v
[
'title'
]
.
' '
.
$area
.
'㎡'
;
$result_data
[]
=
$tmp
;
}
$result
[
'status'
]
=
'successful'
;
...
...
@@ -1279,22 +1301,46 @@ class OfficeRoomService
return
$result
;
}
/**
* 根据地铁id获取字典id
* @param $stations_str
* @return string
*/
private
function
getBuildingByStations
(
$stations_str
)
{
$buildingStationsModel
=
new
OfficeGBuildingStations
();
$field
=
"building_id,stations_id"
;
$params
[
"stations_id"
]
=
array
(
"in"
,
$stations_str
);
$buildingArr
=
$buildingStationsModel
->
getBuilderByStations
(
$field
,
$params
);
$ids
=
""
;
if
(
count
(
$buildingArr
)
>
0
)
{
foreach
(
$buildingArr
as
$item
)
{
$ids
.=
$item
[
"id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
}
return
$ids
;
}
/**
* 标签处理
*
* @param $id
* @return string
*/
private
function
getBuildingSign
(
$id
){
private
function
getBuildingSign
(
$id
)
{
$field
=
'shop_sign'
;
$where
[
'building_id'
]
=
$id
;
$where
[
'status'
]
=
1
;
$res
=
$this
->
m_office_room
->
getRoom
(
$field
,
$where
);
if
(
!
$res
)
if
(
!
$res
)
return
''
;
$shop_sign_old
=
''
;
foreach
(
$res
as
$k
=>
$v
)
{
$shop_sign_old
.=
','
.
$v
[
'shop_sign'
];
foreach
(
$res
as
$k
=>
$v
)
{
$shop_sign_old
.=
','
.
$v
[
'shop_sign'
];
}
$ex_shop_sign_old
=
explode
(
','
,
trim
(
$shop_sign_old
,
","
));
$ex_shop_sign_old
=
array_unique
(
$ex_shop_sign_old
);
//数组去重
...
...
@@ -1308,7 +1354,8 @@ class OfficeRoomService
* @param $data
* @return mixed
*/
public
function
delRoom
(
$data
)
{
public
function
delRoom
(
$data
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
''
;
$result
[
'data'
]
=
[];
...
...
@@ -1319,13 +1366,13 @@ class OfficeRoomService
return
$result
;
}
$house_id
=
$this
->
m_office_room
->
getFieldOneValue
(
'id'
,
[
'id'
=>
$data
[
'id'
],
'status'
=>
[
'<>'
,
3
]]);
$house_id
=
$this
->
m_office_room
->
getFieldOneValue
(
'id'
,
[
'id'
=>
$data
[
'id'
],
'status'
=>
[
'<>'
,
3
]]);
if
(
empty
(
$house_id
))
{
$result
[
'msg'
]
=
'没有该商铺'
;
return
$result
;
}
$is_ok
=
$this
->
m_office_room
->
editData
([
'status'
=>
3
],
$data
[
'id'
]);
$is_ok
=
$this
->
m_office_room
->
editData
([
'status'
=>
3
],
$data
[
'id'
]);
if
(
$is_ok
)
{
//删除商铺对应的收藏商铺也要删除(改状态值)delCollectHouse
$collect_house
=
new
OfficeACollectHouse
();
...
...
@@ -1353,7 +1400,7 @@ class OfficeRoomService
$result
[
'msg'
]
=
''
;
$result
[
'data'
]
=
[];
$data
=
$this
->
m_office_room
->
getFindData
(
'id,is_exclusive_type,agent_start_time,agent_end_time'
,
[
'id'
=>
$room_id
]);
$data
=
$this
->
m_office_room
->
getFindData
(
'id,is_exclusive_type,agent_start_time,agent_end_time'
,
[
'id'
=>
$room_id
]);
if
(
empty
(
$data
[
'id'
]))
{
$result
[
'msg'
]
=
'没有该房源'
;
...
...
@@ -1365,7 +1412,7 @@ class OfficeRoomService
$result_data
[
'agent_start_time'
]
=
$data
[
'agent_start_time'
];
$result_data
[
'agent_end_time'
]
=
$data
[
'agent_end_time'
];
$agent_data
=
$this
->
agent_room
->
getAgentsByRoomId
(
'b.id,b.name,b.phone'
,
[
'a.house_id'
=>
$room_id
,
'a.type'
=>
3
]);
$agent_data
=
$this
->
agent_room
->
getAgentsByRoomId
(
'b.id,b.name,b.phone'
,
[
'a.house_id'
=>
$room_id
,
'a.type'
=>
3
]);
if
(
$agent_data
[
0
])
{
$result_data
[
'name'
]
=
$agent_data
[
0
][
'name'
]
.
'-'
.
$agent_data
[
0
][
'phone'
];
...
...
@@ -1373,7 +1420,7 @@ class OfficeRoomService
$result_data
[
'name'
]
=
''
;
}
$room_img
=
$this
->
m_office_img
->
getListAll
(
'img_name'
,[
'house_id'
=>
$room_id
,
'img_type'
=>
4
]);
$room_img
=
$this
->
m_office_img
->
getListAll
(
'img_name'
,
[
'house_id'
=>
$room_id
,
'img_type'
=>
4
]);
if
(
$room_img
)
{
$result_data
[
'exclusive_img'
]
=
$room_img
;
}
else
{
...
...
@@ -1384,8 +1431,8 @@ class OfficeRoomService
$house_file_where
[
'status'
]
=
0
;
$exclusive_file
=
$this
->
m_house_file
->
getHouseFileAll
(
'id,file_name'
,
$house_file_where
);
if
(
$exclusive_file
)
{
foreach
(
$exclusive_file
as
$k
=>
$v
)
{
$exclusive_file
[
$k
][
'file_name'
]
=
'/static/exclusive_file/'
.
$v
[
'file_name'
];
foreach
(
$exclusive_file
as
$k
=>
$v
)
{
$exclusive_file
[
$k
][
'file_name'
]
=
'/static/exclusive_file/'
.
$v
[
'file_name'
];
}
$result_data
[
'exclusive_file'
]
=
$exclusive_file
;
}
else
{
...
...
@@ -1403,13 +1450,14 @@ class OfficeRoomService
* @param $house_id
* @return array|int|string
*/
public
function
exclusiveFile
(
$data
,
$house_id
)
{
public
function
exclusiveFile
(
$data
,
$house_id
)
{
$result
=
[];
//新增附件
if
(
!
empty
(
$data
[
'exclusive_file'
]))
{
$exclusive_file_arr
=
explode
(
','
,
$data
[
'exclusive_file'
]);
$save_data
=
[];
foreach
(
$exclusive_file_arr
as
$k
=>
$v
)
{
foreach
(
$exclusive_file_arr
as
$k
=>
$v
)
{
$save_data
[
$k
][
'file_name'
]
=
$v
;
$save_data
[
$k
][
'house_id'
]
=
$house_id
;
$save_data
[
$k
][
'type'
]
=
0
;
...
...
@@ -1422,8 +1470,8 @@ class OfficeRoomService
//伪删除附件
if
(
!
empty
(
$data
[
'del_file_id'
]))
{
$file_id_arr
=
explode
(
','
,
$data
[
'del_file_id'
]);
foreach
(
$file_id_arr
as
$k
=>
$v
)
{
$result
[]
=
$this
->
m_house_file
->
where
(
'id'
,
$v
)
->
update
([
'status'
=>
1
]);
foreach
(
$file_id_arr
as
$k
=>
$v
)
{
$result
[]
=
$this
->
m_house_file
->
where
(
'id'
,
$v
)
->
update
([
'status'
=>
1
]);
}
}
...
...
@@ -1436,7 +1484,8 @@ class OfficeRoomService
* @param $data
* @return mixed
*/
public
function
isShow
(
$data
)
{
public
function
isShow
(
$data
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
''
;
$result
[
'data'
]
=
[];
...
...
@@ -1446,13 +1495,13 @@ class OfficeRoomService
return
$result
;
}
try
{
$house_data
=
$this
->
m_office_room
->
getFindData
(
'id,is_show'
,
[
'id'
=>
$data
[
'id'
]]);
$house_data
=
$this
->
m_office_room
->
getFindData
(
'id,is_show'
,
[
'id'
=>
$data
[
'id'
]]);
if
(
empty
(
$house_data
[
'id'
]))
{
$result
[
'msg'
]
=
'没有该房源'
;
return
$result
;
}
else
{
if
(
$house_data
[
'is_show'
]
!=
$data
[
'is_show'
])
{
$this
->
m_office_room
->
editData
([
'is_show'
=>
$data
[
'is_show'
]],
$data
[
'id'
]);
$this
->
m_office_room
->
editData
([
'is_show'
=>
$data
[
'is_show'
]],
$data
[
'id'
]);
$result
[
'status'
]
=
'successful'
;
}
}
...
...
@@ -1471,7 +1520,8 @@ class OfficeRoomService
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public
function
downStatus
(
int
$building_id
,
int
$status
)
{
public
function
downStatus
(
int
$building_id
,
int
$status
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
''
;
$result
[
'data'
]
=
[];
...
...
@@ -1482,7 +1532,7 @@ class OfficeRoomService
}
$where
[
'building_id'
]
=
$building_id
;
$where
[
'status'
]
=
[
'<>'
,
3
];
$num
=
$this
->
m_office_room
->
updateData
([
'status'
=>
$status
],
$where
);
$num
=
$this
->
m_office_room
->
updateData
([
'status'
=>
$status
],
$where
);
if
(
$num
>
0
)
{
$result
[
'status'
]
=
'successful'
;
$result
[
'msg'
]
=
'修改成功'
;
...
...
@@ -1498,7 +1548,8 @@ class OfficeRoomService
* @param $params
* @return mixed
*/
public
function
checkRepetition
(
$params
)
{
public
function
checkRepetition
(
$params
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
''
;
$result
[
'data'
]
=
[];
...
...
@@ -1520,15 +1571,15 @@ class OfficeRoomService
if
(
$list
)
{
$data
=
[];
foreach
(
$list
as
$k
=>
$v
)
{
foreach
(
$list
as
$k
=>
$v
)
{
$data
[
$k
][
'id'
]
=
$v
[
'id'
];
$data
[
$k
][
'address'
]
=
$v
[
'mansion'
]
.
'-'
.
$v
[
'floor'
]
.
'-'
.
$v
[
'room_number'
];
$data
[
$k
][
'address'
]
=
$v
[
'mansion'
]
.
'-'
.
$v
[
'floor'
]
.
'-'
.
$v
[
'room_number'
];
}
$result
[
'data'
]
=
$data
;
}
$result
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$result
[
'msg'
]
=
"内部错误:"
.
$e
->
getMessage
();
$result
[
'msg'
]
=
"内部错误:"
.
$e
->
getMessage
();
}
return
$result
;
}
...
...
application/model/OfficeGBuildingStations.php
View file @
0c28c244
...
...
@@ -61,6 +61,14 @@ class OfficeGBuildingStations extends BaseModel
->
select
();
}
public
function
getBuilderByStations
(
$field
,
$where
){
$where
[
'a.is_del'
]
=
0
;
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
select
();
}
/**
* @param $data
* @param $where
...
...
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