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
7ae8a6c6
Commit
7ae8a6c6
authored
Nov 23, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
房东手机号拆分
parent
637bf014
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
408 additions
and
163 deletions
+408
-163
Shop.php
application/api_broker/controller/Shop.php
+8
-6
Houses.php
application/index/controller/Houses.php
+13
-84
WatchShop.php
application/index/controller/WatchShop.php
+1
-1
HouseService.php
application/index/service/HouseService.php
+218
-29
ACase.php
application/model/ACase.php
+16
-0
GBusinessDistrict.php
application/model/GBusinessDistrict.php
+9
-0
GHouses.php
application/model/GHouses.php
+22
-6
GHousesExt.php
application/model/GHousesExt.php
+37
-37
GHousesImgs.php
application/model/GHousesImgs.php
+16
-0
GLandlordPhone.php
application/model/GLandlordPhone.php
+68
-0
No files found.
application/api_broker/controller/Shop.php
View file @
7ae8a6c6
...
...
@@ -577,18 +577,14 @@ class Shop extends Basic
* 新增和编辑商铺
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
edit
()
{
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
''
;
$result_data
=
[];
$house
=
new
HouseService
();
if
(
$this
->
request
->
isPost
())
{
$house
=
new
HouseService
();
$data
=
$house
->
addHouse
(
$this
->
params
,
$this
->
agentId
,
1
);
if
(
$data
[
'status'
]
==
'successful'
)
{
...
...
@@ -605,7 +601,13 @@ class Shop extends Basic
$result
[
'msg'
]
=
'Id is null'
;
}
else
{
//获取商铺详情
$result_data
=
$this
->
gHousesModel
->
getHouseById
(
$this
->
params
[
'id'
],
1
);
$data
=
$house
->
getHouseById
(
$this
->
params
[
'id'
],
1
);
if
(
$data
[
'status'
]
==
'successful'
)
{
$result_data
=
$data
;
}
else
{
$result
[
'msg'
]
=
$data
[
'msg'
];
$result
[
'code'
]
=
101
;
}
}
}
...
...
application/index/controller/Houses.php
View file @
7ae8a6c6
...
...
@@ -40,79 +40,6 @@ class Houses extends Basic
$this
->
house
=
new
GHouses
();
}
/**
* 新增和编辑商铺
*
* @return \think\Response|\think\response\View
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
edit
()
{
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
''
;
if
(
$this
->
request
->
isPost
())
{
$validate
=
new
HouseValidate
();
$check
=
$validate
->
check
(
$this
->
params
);
if
(
true
!==
$check
){
return
$this
->
response
(
101
,
$validate
->
getError
());
}
$house_id
=
$this
->
house
->
add
(
$this
->
params
,
$this
->
userId
);
//添加或编辑商铺
if
(
!
empty
(
$this
->
params
[
'sublet_id'
])
&&
$this
->
params
[
'source'
]
==
'transfer_list'
)
{
$m_sublet
=
new
SubletModel
();
$sublet_data
[
'house_id'
]
=
$house_id
[
'house_id'
];
$sublet_data
[
'status'
]
=
2
;
$sublet_data
[
'agents_id'
]
=
$this
->
userId
;
$m_sublet
->
editData
(
$sublet_data
,
$this
->
params
[
'sublet_id'
]);
}
if
(
$house_id
[
'house_id'
])
{
$return
=
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
[
'id'
,
$house_id
[
'house_id'
]
]);
// if (isset($house_id['status']) && $house_id['status'] == 2) {
// $push_service = new PushMessageService();
// $push_service->pushHouseDownMessage($house_id['house_id']);
// }
}
else
{
$return
=
$this
->
response
(
101
,
'add houses is error'
);
}
//编辑商铺
}
elseif
(
$this
->
params
[
'id'
])
{
if
(
$this
->
request
->
isAjax
())
{
//获取商铺详情
$house
=
new
GHouses
();
$result
[
'data'
]
=
$house
->
getHouseById
(
$this
->
params
[
'id'
],
0
);
$return
=
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
$result
[
'data'
]);
}
else
{
//商铺添加页面
$return
=
view
(
'edit'
);
}
//转铺页面跳转过来的
}
elseif
(
isset
(
$this
->
params
[
'source'
])
&&
$this
->
params
[
'source'
]
==
'transfer_list'
)
{
if
(
$this
->
request
->
isAjax
())
{
$sublet
=
new
SubletModel
();
$result
[
'data'
]
=
$sublet
->
getSubletHouse
(
$this
->
params
[
'sublet_id'
]);
$return
=
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
$result
[
'data'
]);
}
else
{
//商铺添加页面
$return
=
view
(
'edit'
);
}
}
else
{
//商铺添加页面
$return
=
view
(
'edit'
);
}
return
$return
;
}
/**
* 新增和编辑商铺
*
...
...
@@ -123,9 +50,10 @@ class Houses extends Basic
{
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
$return
=
''
;
$result
[
'data'
]
=
[];
$house
=
new
HouseService
();
if
(
$this
->
request
->
isPost
())
{
$house
=
new
HouseService
();
$house_data
=
$house
->
addHouse
(
$this
->
params
,
$this
->
userId
);
if
(
$house_data
[
'status'
]
==
'successful'
)
{
...
...
@@ -147,8 +75,12 @@ class Houses extends Basic
if
(
$this
->
request
->
isAjax
())
{
//获取商铺详情
try
{
$house
=
new
GHouses
();
$result
[
'data'
]
=
$house
->
getHouseById
(
$this
->
params
[
'id'
],
0
);
$list
=
$house
->
getHouseById
(
$this
->
params
[
'id'
],
0
);
if
(
$list
[
'status'
]
==
'successful'
)
{
$result
[
'data'
]
=
$list
[
'data'
];
}
else
{
$result
[
'msg'
]
=
$list
[
'msg'
];
}
}
catch
(
\Exception
$e
)
{
$result
[
'data'
]
=
[];
$result
[
'code'
]
=
101
;
...
...
@@ -760,8 +692,7 @@ class Houses extends Basic
return
$this
->
response
(
101
,
'参数错误'
);
}
$house
=
new
GHouses
();
$num
=
$house
->
editData
([
'is_lock'
=>
$this
->
params
[
'is_lock'
]],
$this
->
params
[
'house_id'
]);
$num
=
$this
->
house
->
editData
([
'is_lock'
=>
$this
->
params
[
'is_lock'
]],
$this
->
params
[
'house_id'
]);
if
(
$num
>
0
)
{
return
$this
->
response
(
200
,
''
);
...
...
@@ -808,8 +739,7 @@ class Houses extends Basic
}
try
{
$house
=
new
GHouses
();
$house_data
=
$house
->
getHouseDetail
(
'id,is_show'
,
[
'id'
=>
$this
->
params
[
'id'
]]);
$house_data
=
$this
->
house
->
getHouseDetail
(
'id,is_show'
,
[
'id'
=>
$this
->
params
[
'id'
]]);
if
(
empty
(
$house_data
[
'id'
]))
{
$code
=
101
;
...
...
@@ -843,15 +773,14 @@ class Houses extends Basic
}
try
{
$house
=
new
GHouses
();
$house_data
=
$house
->
getHouseDetail
(
'id,is_vip'
,
[
'id'
=>
$this
->
params
[
'id'
]]);
$house_data
=
$this
->
house
->
getHouseDetail
(
'id,is_vip'
,
[
'id'
=>
$this
->
params
[
'id'
]]);
if
(
empty
(
$house_data
[
'id'
]))
{
$code
=
101
;
$msg
=
'没有该商铺'
;
}
else
{
if
(
$house_data
[
'is_vip'
]
!=
$this
->
params
[
'vip'
])
{
$house
->
editData
([
'is_vip'
=>
$this
->
params
[
'vip'
]],
$this
->
params
[
'id'
]);
$
this
->
house
->
editData
([
'is_vip'
=>
$this
->
params
[
'vip'
]],
$this
->
params
[
'id'
]);
}
}
}
catch
(
\Exception
$e
)
{
...
...
application/index/controller/WatchShop.php
View file @
7ae8a6c6
...
...
@@ -124,7 +124,7 @@ class WatchShop extends Basic
$appoint_data
=
$appoint_watch
->
getAppointInfo
(
$fields
,
$where
);
if
(
empty
(
$appoint_data
[
'id'
]))
{
return
$this
->
response
(
101
,
'没有预约铺经纪人信息'
);
return
$this
->
response
(
101
,
'没有预约
看
铺经纪人信息'
);
}
$agent
=
new
AAgents
();
...
...
application/index/service/HouseService.php
View file @
7ae8a6c6
...
...
@@ -13,12 +13,14 @@ use app\api_broker\service\PushMessageService;
use
app\api_broker\service\VipService
;
use
app\index\validate\HouseValidate
;
use
app\model\AAgents
;
use
app\model\ACase
;
use
app\model\GBusinessDistrict
;
use
app\model\GHouseFile
;
use
app\model\GHouses
;
use
app\model\GHousesExt
;
use
app\model\GHousesImgs
;
use
app\model\GHousesToAgents
;
use
app\model\GLandlordPhone
;
use
app\model\GOperatingRecords
;
use
app\task\controller\ResultsSummaryNewTask
;
...
...
@@ -71,6 +73,12 @@ class HouseService
}
try
{
if
(
$is_app
==
1
)
{
$landlord_phone_new
=
json_decode
(
$data
[
'landlord_phone'
],
true
);
}
else
{
$landlord_phone_new
=
$data
[
'landlord_phone'
];
}
$landlord_phone_old
=
$this
->
landlordPhoneEdit
(
$landlord_phone_new
,
$data
[
'id'
]);
die
;
if
(
!
empty
(
$data
[
'id'
]))
{
$house_data
=
$this
->
m_house
->
getHouseInfo
(
'id,internal_address,internal_title'
,
[
'id'
=>
$data
[
'id'
]]);
if
(
empty
(
$house_data
[
0
][
'id'
]))
{
...
...
@@ -93,37 +101,11 @@ class HouseService
$remark
.=
',地址改为:'
.
$data
[
'internal_address'
];
}
$house_data_ext
=
$this
->
m_house_ext
->
getInfo
(
'landlord_phone'
,
[
'house_id'
=>
$data
[
'id'
]]);
if
(
!
empty
(
$house_data_ext
[
'landlord_phone'
]))
{
$landlord_phone_arr
=
$landlord_phone_new_arr
=
$landlord_phone_old
=
[];
$landlord_phone
=
json_decode
(
$house_data_ext
[
'landlord_phone'
],
true
);
if
(
$is_app
==
1
)
{
$landlord_phone_new
=
json_decode
(
$data
[
'landlord_phone'
],
true
);
}
else
{
$landlord_phone_new
=
$data
[
'landlord_phone'
];
}
foreach
(
$landlord_phone
as
$v
)
{
$landlord_phone_arr
[]
=
$v
[
'phone'
];
}
foreach
(
$landlord_phone_new
as
$v2
)
{
$landlord_phone_new_arr
[]
=
$v2
[
'phone'
];
}
foreach
(
$landlord_phone_arr
as
$v3
)
{
if
(
!
empty
(
$v3
)
&&
!
in_array
(
$v3
,
$landlord_phone_new_arr
))
{
$landlord_phone_old
[]
=
$v3
;
}
}
$landlord_phone_old
=
$this
->
landlordPhoneEdit
(
$landlord_phone_new
,
$data
[
'id'
]);
if
(
!
empty
(
$landlord_phone_old
))
{
$remark
.=
',删除房东手机号:'
.
implode
(
','
,
$landlord_phone_old
);
}
if
(
!
empty
(
$landlord_phone_old
))
{
$remark
.=
',删除房东手机号:'
.
implode
(
','
,
$landlord_phone_old
);
}
$m_operating
->
record
(
$agent_id
,
6
,
$remark
,
$data
[
'id'
]);
}
...
...
@@ -135,6 +117,11 @@ class HouseService
return
$result
;
}
//新增房东手机号
if
(
empty
(
$data
[
'id'
]))
{
$this
->
landlordPhoneEdit
(
$landlord_phone_new
,
$house_id
);
}
$house_img
=
new
GHousesImgs
();
//商铺扩展字段
...
...
@@ -464,4 +451,205 @@ class HouseService
return
$result
;
}
/**
* 房东手机号处理
*
* @param array $data
* @param $house_id
* @return array 删除的手机号
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public
function
landlordPhoneEdit
(
array
$data
,
$house_id
)
{
$m_landlord
=
new
GLandlordPhone
();
$update_data
=
$insert_data
=
$new_phone
=
$del_phone
=
[];
$key
=
0
;
$old_landlord
=
$m_landlord
->
getColumn
(
'id,phone'
,
[
'house_id'
=>
$house_id
,
'status'
=>
0
]);
foreach
(
$data
as
$k
=>
$v
)
{
$id
=
array_search
(
$v
[
'phone'
],
$old_landlord
);
if
(
$id
)
{
$update_data
[
$key
][
'id'
]
=
$id
;
$update_data
[
$key
][
'name'
]
=
$v
[
'name'
];
$update_data
[
$key
][
'phone'
]
=
$v
[
'phone'
];
$update_data
[
$key
][
'house_id'
]
=
$house_id
;
}
else
{
$insert_data
[
$key
][
'name'
]
=
$v
[
'name'
];
$insert_data
[
$key
][
'phone'
]
=
$v
[
'phone'
];
$insert_data
[
$key
][
'house_id'
]
=
$house_id
;
}
$new_phone
[]
=
$v
[
'phone'
];
$key
++
;
}
foreach
(
$old_landlord
as
$k2
=>
$v2
)
{
if
(
!
in_array
(
$v2
,
$new_phone
))
{
$update_data
[
$key
][
'id'
]
=
$k2
;
$update_data
[
$key
][
'status'
]
=
1
;
$key
++
;
$del_phone
[]
=
$v2
;
}
}
if
(
$update_data
)
{
$m_landlord
->
updateData
(
$update_data
);
}
if
(
$insert_data
)
{
$m_landlord
->
insertData
(
$insert_data
);
}
return
$del_phone
;
}
/**
* 获取商铺信息
*
* @param int $id
* @param int $app
* @return array
*/
public
function
getHouseById
(
int
$id
,
int
$app
=
0
)
:
array
{
try
{
$data
=
[];
$result
=
$this
->
m_house
->
getHouseExtInfo
(
'a.*,b.*'
,
[
'a.id'
=>
$id
,
'status'
=>
[
'<>'
,
3
]]);
if
(
$result
)
{
$data
=
$result
->
toArray
();
$data
[
'landmark'
]
=
empty
(
$data
[
'landmark'
])
?
$data
[
'internal_address'
]
:
$data
[
'landmark'
];
/*案场,盘方,独家 start*/
$houseAgents
=
new
GHousesToAgents
();
$agents_data
=
$houseAgents
->
getHousesAgents
(
$id
);
$agents_str
=
$exclusive_str
=
$dish_str
=
''
;
foreach
(
$agents_data
as
$k
=>
$v
)
{
if
(
$v
[
'type'
]
==
1
)
{
$agents_str
.=
$v
[
'id'
]
.
','
;
$data
[
'agents_name'
][]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
$data
[
'agents_name_arr'
][]
=
[
'id'
=>
$v
[
'id'
],
'name'
=>
$v
[
'name'
],
'phone'
=>
$v
[
'phone'
],
];
}
elseif
(
$v
[
'type'
]
==
2
)
{
$dish_str
.=
$v
[
'id'
]
.
','
;
$data
[
'dish_name'
][]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
$data
[
'dish_name_arr'
][]
=
[
'id'
=>
$v
[
'id'
],
'name'
=>
$v
[
'name'
],
'phone'
=>
$v
[
'phone'
],
];
}
elseif
(
$v
[
'type'
]
==
3
)
{
$exclusive_str
.=
$v
[
'id'
]
.
','
;
$data
[
'exclusive_name'
][]
=
$v
[
'id'
]
.
'-'
.
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
$data
[
'exclusive_name_arr'
][]
=
[
'id'
=>
$v
[
'id'
],
'name'
=>
$v
[
'name'
],
'phone'
=>
$v
[
'phone'
],
];
}
}
$data
[
'agent_data'
]
=
rtrim
(
$agents_str
,
','
);
$data
[
'agent_dish'
]
=
rtrim
(
$dish_str
,
','
);
$data
[
'exclusive_ids'
]
=
rtrim
(
$exclusive_str
,
','
);
/*案场,盘方,独家 end*/
/*案场联系人 start*/
$case
=
new
ACase
();
$data
[
'phone'
]
=
$case
->
getListAll
(
'id,name,phone'
,
[
'id'
=>
[
'in'
,
$data
[
'case_id'
]],
'status'
=>
0
]);
/*案场联系人 end*/
$data
[
'rent_price'
]
=
$data
[
'rent_price'
]
/
100
;
//存分
$data
[
'management_fee'
]
=
$data
[
'management_fee'
]
/
100
;
//存分
$data
[
'slotting_fee'
]
=
$data
[
'slotting_fee'
]
/
100
;
//存分
if
(
$data
[
'external_slotting_fee'
]
!=
-
1
)
{
$data
[
'external_slotting_fee'
]
=
$data
[
'external_slotting_fee'
]
*
0.01
;
//存分
}
/*图片 start*/
$img
=
new
GHousesImgs
();
$img_data
=
$img
->
getListAll
(
'id,img_type,img_name'
,
[
'img_status'
=>
0
,
'house_id'
=>
$id
]);
$area
=
explode
(
'##'
,
$data
[
'code'
]);
$data
[
'province_code'
]
=
$area
[
0
];
$data
[
'city_code'
]
=
$area
[
1
];
$data
[
'disc_code'
]
=
$area
[
2
];
$data
[
'slide_show'
]
=
$data
[
'plan'
]
=
$data
[
'exclusive_img'
]
=
[];
$data
[
'landlord_phone'
]
=
empty
(
$data
[
'landlord_phone'
])
?
""
:
$data
[
'landlord_phone'
];
$data
[
'agent_end_time'
]
=
empty
(
$data
[
'agent_end_time'
])
?
""
:
$data
[
'agent_end_time'
];
$data
[
'agent_start_time'
]
=
empty
(
$data
[
'agent_start_time'
])
?
""
:
$data
[
'agent_start_time'
];
$data
[
'landlord_phone'
]
=
empty
(
$data
[
'landlord_phone'
])
?
""
:
$data
[
'landlord_phone'
];
$data
[
'internal_item_advantage'
]
=
empty
(
$data
[
'internal_item_advantage'
])
?
""
:
$data
[
'internal_item_advantage'
];
$data
[
'fee_rule'
]
=
empty
(
$data
[
'fee_rule'
])
?
""
:
$data
[
'fee_rule'
];
$data
[
'opening_date'
]
=
empty
(
$data
[
'opening_date'
])
?
''
:
$data
[
'opening_date'
];
$data
[
'operation_id'
]
=
empty
(
$data
[
'operation_id'
])
?
''
:
$data
[
'operation_id'
];
$data
[
'payment_month'
]
=
empty
(
$data
[
'payment_month'
])
?
''
:
$data
[
'payment_month'
];
$data
[
'city_code'
]
=
empty
(
$data
[
'city_code'
])
?
""
:
$data
[
'city_code'
];
$data
[
'disc_code'
]
=
empty
(
$data
[
'disc_code'
])
?
""
:
$data
[
'disc_code'
];
$data
[
'deposit_month'
]
=
empty
(
$data
[
'deposit_month'
])
?
''
:
$data
[
'deposit_month'
];
if
(
$app
==
0
)
{
foreach
(
$img_data
as
$k
=>
$v
)
{
switch
(
$v
->
img_type
)
{
case
1
:
$data
[
'cover'
]
=
$v
->
img_name
;
break
;
case
2
:
$data
[
'slide_show'
][
$k
][
'img_name'
]
=
$v
->
img_name
;
$data
[
'slide_show'
][
$k
][
'id'
]
=
$v
->
id
;
break
;
case
3
:
$data
[
'plan'
][
$k
][
'img_name'
]
=
$v
->
img_name
;
$data
[
'plan'
][
$k
][
'id'
]
=
$v
->
id
;
break
;
default
:
$data
[
'exclusive_img'
][
$k
][
'img_name'
]
=
$v
->
img_name
;
$data
[
'exclusive_img'
][
$k
][
'id'
]
=
$v
->
id
;
}
}
}
else
{
$file_url
=
[];
foreach
(
$img_data
as
$k
=>
$v
)
{
$img_url
=
CK_IMG_URL
.
'images/'
.
$v
->
img_name
;
$file_url
[
'file_name'
]
=
$img_url
;
$file_url
[
'save_path'
]
=
$v
->
img_name
;
switch
(
$v
->
img_type
)
{
case
1
:
$data
[
'cover'
]
=
$file_url
;
break
;
case
2
:
$data
[
'slide_show'
][]
=
$file_url
;
break
;
case
3
:
$data
[
'plan'
][]
=
$file_url
;
break
;
default
:
$data
[
'exclusive_img'
][]
=
$file_url
;
}
}
}
if
(
!
empty
(
$data
[
'business_district_id'
]))
{
$business
=
new
GBusinessDistrict
();
$data
[
'business_name'
]
=
$business
->
getValue
([
'id'
=>
$data
[
'business_district_id'
]],
'name'
);
}
else
{
$data
[
'business_name'
]
=
""
;
}
/*图片 end*/
$m_landlord
=
new
GLandlordPhone
();
$data
[
'landlord_phone_array'
]
=
$m_landlord
->
getAllList
(
'id,name,phone'
,
[
'house_id'
=>
$id
,
'status'
=>
0
]);
//房东手机号
}
$return
[
'data'
]
=
$data
;
$return
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$return
[
'msg'
]
=
$e
->
getMessage
();
$return
[
'status'
]
=
'fail'
;
}
return
$return
;
}
}
\ No newline at end of file
application/model/ACase.php
View file @
7ae8a6c6
...
...
@@ -58,4 +58,19 @@ class ACase extends BaseModel
$id_str
=
rtrim
(
$id_str
,
','
);
return
$id_str
;
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getListAll
(
$field
,
$where
)
{
return
$this
->
field
(
$field
)
->
where
(
$where
)
->
select
();
}
}
\ No newline at end of file
application/model/GBusinessDistrict.php
View file @
7ae8a6c6
...
...
@@ -41,4 +41,13 @@ class GBusinessDistrict extends BaseModel
return
$this
->
query
(
$sql
);
}
/**
* @param $where
* @param $field
* @return mixed
*/
public
function
getValue
(
$where
,
$field
)
{
return
$this
->
where
(
$where
)
->
value
(
$field
);
}
}
application/model/GHouses.php
View file @
7ae8a6c6
...
...
@@ -33,15 +33,15 @@ class GHouses extends BaseModel
if
(
$select_data
)
{
$data
=
$select_data
->
getData
();
$data
[
'landlord_phone_array'
]
=
json_decode
(
$data
[
'landlord_phone'
],
true
);
//
$data['landlord_phone_array'] = json_decode($data['landlord_phone'], true);
$landlord_phone
=
''
;
//
$landlord_phone = '';
foreach
(
$data
[
'landlord_phone_array'
]
as
$kk
=>
$vv
)
{
$landlord_phone
[]
=
$vv
[
'phone'
];
}
//
foreach ($data['landlord_phone_array'] as $kk => $vv) {
//
$landlord_phone[] = $vv['phone'];
//
}
$data
[
'landlord_phone'
]
=
implode
(
','
,
$landlord_phone
);
//
$data['landlord_phone'] = implode(',', $landlord_phone);
$data
[
'landmark'
]
=
empty
(
$data
[
'landmark'
])
?
$data
[
'internal_address'
]
:
$data
[
'landmark'
];
/*案场,盘方,独家 start*/
...
...
@@ -1623,4 +1623,20 @@ class GHouses extends BaseModel
return
$this
->
where
(
$where
)
->
value
(
$field
);
}
/**
* @param $field
* @param $where_
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getHouseExtInfo
(
$field
,
$where_
)
{
return
$this
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"g_houses_ext b"
,
"a.id = b.house_id"
,
"left"
)
->
where
(
$where_
)
->
find
();
}
}
application/model/GHousesExt.php
View file @
7ae8a6c6
...
...
@@ -120,43 +120,43 @@ class GHousesExt extends BaseModel
}
//房东手机号
if
(
!
empty
(
$data
[
'landlord_phone'
]))
{
$landlord_phone
=
[];
if
(
$is_app
==
1
)
{
$landlord_phone_arr
=
json_decode
(
$data
[
'landlord_phone'
],
true
);
if
(
is_array
(
$landlord_phone_arr
))
{
foreach
(
$landlord_phone_arr
as
$k
=>
$v
)
{
if
(
!
empty
(
$v
[
'phone'
]))
{
$landlord_phone
[
$k
][
'name'
]
=
empty
(
$v
[
'name'
])
?
'房东'
:
$v
[
'name'
];
$landlord_phone
[
$k
][
'phone'
]
=
$v
[
'phone'
];
}
}
}
}
else
{
if
(
is_array
(
$data
[
'landlord_phone'
]))
{
foreach
(
$data
[
'landlord_phone'
]
as
$k
=>
$v
)
{
if
(
!
empty
(
$v
[
'phone'
]))
{
$landlord_phone
[
$k
][
'name'
]
=
empty
(
$v
[
'name'
])
?
'房东'
:
$v
[
'name'
];
$landlord_phone
[
$k
][
'phone'
]
=
$v
[
'phone'
];
}
}
}
else
{
//兼容之前逗号隔开的手机号
$params
[
'landlord_phone'
]
=
explode
(
','
,
$data
[
'landlord_phone'
]);
foreach
(
$params
[
'landlord_phone'
]
as
$key
=>
$val
)
{
$landlord_phone
[
$key
][
'name'
]
=
'房东'
;
$landlord_phone
[
$key
][
'phone'
]
=
trim
(
$val
);
}
}
}
if
(
isset
(
$landlord_phone
[
0
][
'phone'
]))
{
$save_data
[
'landlord_phone'
]
=
json_encode
(
$landlord_phone
);
}
}
//
if (!empty($data['landlord_phone'])) {
//
$landlord_phone = [];
//
//
if ($is_app == 1) {
//
$landlord_phone_arr = json_decode($data['landlord_phone'], true);
//
//
if (is_array($landlord_phone_arr)) {
//
foreach ($landlord_phone_arr as $k => $v) {
//
if (!empty($v['phone'])) {
//
$landlord_phone[$k]['name'] = empty($v['name']) ? '房东' : $v['name'];
//
$landlord_phone[$k]['phone'] = $v['phone'];
//
}
//
}
//
}
//
} else {
//
if (is_array($data['landlord_phone'])) {
//
foreach ($data['landlord_phone'] as $k => $v) {
//
if (!empty($v['phone'])) {
//
$landlord_phone[$k]['name'] = empty($v['name']) ? '房东' : $v['name'];
//
$landlord_phone[$k]['phone'] = $v['phone'];
//
}
//
}
//
} else {
//
//兼容之前逗号隔开的手机号
//
$params['landlord_phone'] = explode(',', $data['landlord_phone']);
//
//
foreach ($params['landlord_phone'] as $key => $val) {
//
$landlord_phone[$key]['name'] = '房东';
//
$landlord_phone[$key]['phone'] = trim($val);
//
}
//
}
//
}
//
//
if (isset($landlord_phone[0]['phone'])) {
//
$save_data['landlord_phone'] = json_encode($landlord_phone);
//
}
//
}
//房东备注
if
(
isset
(
$data
[
'landlord_remark'
]))
{
...
...
application/model/GHousesImgs.php
View file @
7ae8a6c6
...
...
@@ -292,4 +292,19 @@ class GHousesImgs extends BaseModel
$this
->
add
(
$params
,
$house_id
);
return
$this
->
saveAll
(
$house_img_edit
);
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getListAll
(
$field
,
$where
)
{
return
$this
->
field
(
$field
)
->
where
(
$where
)
->
select
();
}
}
\ No newline at end of file
application/model/GLandlordPhone.php
View file @
7ae8a6c6
...
...
@@ -9,8 +9,75 @@
namespace
app\model
;
use
think\Db
;
class
GLandlordPhone
extends
BaseModel
{
protected
$table
=
'g_landlord_phone'
;
private
$db_
;
public
function
__construct
(
$data
=
[])
{
parent
::
__construct
(
$data
);
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getInfo
(
$field
,
$where
)
{
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
find
();
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAllList
(
$field
,
$where
)
{
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
select
();
}
/**
* @param $field
* @param $where
* @return array
*/
public
function
getColumn
(
$field
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
column
(
$field
);
}
/**
* @param $data
* @return int|string
*/
public
function
insertData
(
$data
)
{
return
$this
->
db_
->
insertAll
(
$data
);
}
/**
* @param $data
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public
function
updateData
(
$data
)
{
foreach
(
$data
as
$v
)
{
$this
->
db_
->
update
(
$v
);
}
return
;
}
}
\ No newline at end of file
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