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
eb13b8dd
Commit
eb13b8dd
authored
Nov 21, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异常捕获
parent
4fac74d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
110 deletions
+114
-110
VipService.php
application/api_broker/service/VipService.php
+1
-1
HouseService.php
application/index/service/HouseService.php
+113
-109
No files found.
application/api_broker/service/VipService.php
View file @
eb13b8dd
...
@@ -17,7 +17,7 @@ class VipService
...
@@ -17,7 +17,7 @@ class VipService
/**
/**
* 是否具有查看vip客户权限
* 是否具有查看vip客户权限
*
*
* @param $id 经纪人ID
* @param $id
//
经纪人ID
* @param string $name
* @param string $name
* @return int 是否可以查看vip客户 0:可查看 1:不可查看
* @return int 是否可以查看vip客户 0:可查看 1:不可查看
*/
*/
...
...
application/index/service/HouseService.php
View file @
eb13b8dd
...
@@ -24,17 +24,19 @@ use app\task\controller\ResultsSummaryNewTask;
...
@@ -24,17 +24,19 @@ use app\task\controller\ResultsSummaryNewTask;
class
HouseService
class
HouseService
{
{
protected
$house
;
protected
$
m_
house
;
protected
$agent
;
protected
$agent
;
protected
$agent_house
;
protected
$agent_house
;
protected
$push
;
protected
$push
;
protected
$m_house_ext
;
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
house
=
new
GHouses
();
$this
->
m_
house
=
new
GHouses
();
$this
->
agent
=
new
AAgents
();
$this
->
agent
=
new
AAgents
();
$this
->
agent_house
=
new
GHousesToAgents
();
$this
->
agent_house
=
new
GHousesToAgents
();
$this
->
push
=
new
PushMessageService
();
$this
->
push
=
new
PushMessageService
();
$this
->
m_house_ext
=
new
GHousesExt
();
}
}
/**
/**
...
@@ -44,163 +46,165 @@ class HouseService
...
@@ -44,163 +46,165 @@ class HouseService
* @param int $agent_id
* @param int $agent_id
* @param int $is_app
* @param int $is_app
* @return array
* @return array
* @throws \think\exception\PDOException
*/
*/
public
function
addHouse
(
array
$data
,
int
$agent_id
,
$is_app
=
0
)
:
array
public
function
addHouse
(
array
$data
,
int
$agent_id
,
$is_app
=
0
)
:
array
{
{
$result
=
[];
$result
=
[];
$validate
=
new
HouseValidate
();
$validate
=
new
HouseValidate
();
if
(
empty
(
$data
[
'id'
]))
{
if
(
empty
(
$data
[
'id'
]))
{
$check
=
$validate
->
scene
(
'add'
)
->
check
(
$data
);
$check
=
$validate
->
scene
(
'add'
)
->
check
(
$data
);
}
else
{
}
else
{
$check
=
$validate
->
scene
(
'edit'
)
->
check
(
$data
);
$check
=
$validate
->
scene
(
'edit'
)
->
check
(
$data
);
}
}
if
(
!
$check
)
{
if
(
!
$check
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$validate
->
getError
();
$result
[
'msg'
]
=
$validate
->
getError
();
return
$result
;
return
$result
;
}
}
if
(
empty
(
$agent_id
))
{
if
(
empty
(
$agent_id
))
{
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'上传人id为空'
;
$result
[
'msg'
]
=
'上传人id为空'
;
return
$result
;
return
$result
;
}
}
if
(
!
empty
(
$data
[
'id'
]))
{
try
{
$house_data
=
$this
->
house
->
getHouseInfo
(
'id,internal_address,internal_title'
,
[
'id'
=>
$data
[
'id'
]]);
if
(
!
empty
(
$data
[
'id'
]))
{
if
(
empty
(
$house_data
[
0
][
'id'
]))
{
$house_data
=
$this
->
m_house
->
getHouseInfo
(
'id,internal_address,internal_title'
,
[
'id'
=>
$data
[
'id'
]]);
$result
[
'status'
]
=
'fail'
;
if
(
empty
(
$house_data
[
0
][
'id'
]))
{
$result
[
'msg'
]
=
'没有该商铺信息'
;
$result
[
'status'
]
=
'fail'
;
return
$result
;
$result
[
'msg'
]
=
'没有该商铺信息'
;
}
return
$result
;
}
$m_operating
=
new
GOperatingRecords
();
$m_operating
=
new
GOperatingRecords
();
$remark
=
'修改为:剩余铺数'
.
$data
[
'residue_num'
];
$remark
=
'修改为:剩余铺数'
.
$data
[
'residue_num'
];
if
(
$data
[
'is_exclusive_type'
]
==
1
)
{
if
(
$data
[
'is_exclusive_type'
]
==
1
)
{
$remark
.=
',独家有效期 '
.
$data
[
'agent_start_time'
]
.
'—'
.
$data
[
'agent_end_time'
];
$remark
.=
',独家有效期 '
.
$data
[
'agent_start_time'
]
.
'—'
.
$data
[
'agent_end_time'
];
}
}
if
(
$data
[
'internal_title'
]
!=
$house_data
[
0
][
'internal_title'
])
{
if
(
$data
[
'internal_title'
]
!=
$house_data
[
0
][
'internal_title'
])
{
$remark
.=
',商铺名改为:'
.
$data
[
'internal_title'
];
$remark
.=
',商铺名改为:'
.
$data
[
'internal_title'
];
}
}
if
(
$data
[
'internal_address'
]
!=
$house_data
[
0
][
'internal_address'
])
{
if
(
$data
[
'internal_address'
]
!=
$house_data
[
0
][
'internal_address'
])
{
$remark
.=
',地址改为:'
.
$data
[
'internal_address'
];
$remark
.=
',地址改为:'
.
$data
[
'internal_address'
];
}
}
$house_ext
=
new
GHousesExt
();
$house_data_ext
=
$house_ext
->
getInfo
(
'landlord_phone'
,
[
'house_id'
=>
$data
[
'id'
]]);
$house_data_ext
=
$this
->
m_house_ext
->
getInfo
(
'landlord_phone'
,
[
'house_id'
=>
$data
[
'id'
]]);
if
(
!
empty
(
$house_data_ext
[
'landlord_phone'
]))
{
if
(
!
empty
(
$house_data_ext
[
'landlord_phone'
]))
{
$landlord_phone_arr
=
$landlord_phone_new_arr
=
$landlord_phone_old
=
[];
$landlord_phone_arr
=
$landlord_phone_new_arr
=
$landlord_phone_old
=
[];
$landlord_phone
=
json_decode
(
$house_data_ext
[
'landlord_phone'
],
true
);
$landlord_phone
=
json_decode
(
$house_data_ext
[
'landlord_phone'
],
true
);
if
(
$is_app
==
1
)
{
if
(
$is_app
==
1
)
{
$landlord_phone_new
=
json_decode
(
$data
[
'landlord_phone'
],
true
);
$landlord_phone_new
=
json_decode
(
$data
[
'landlord_phone'
],
true
);
}
else
{
}
else
{
$landlord_phone_new
=
$data
[
'landlord_phone'
];
$landlord_phone_new
=
$data
[
'landlord_phone'
];
}
}
foreach
(
$landlord_phone
as
$v
)
{
foreach
(
$landlord_phone
as
$v
)
{
$landlord_phone_arr
[]
=
$v
[
'phone'
];
$landlord_phone_arr
[]
=
$v
[
'phone'
];
}
}
foreach
(
$landlord_phone_new
as
$v2
)
{
foreach
(
$landlord_phone_new
as
$v2
)
{
$landlord_phone_new_arr
[]
=
$v2
[
'phone'
];
$landlord_phone_new_arr
[]
=
$v2
[
'phone'
];
}
}
foreach
(
$landlord_phone_arr
as
$v3
)
{
foreach
(
$landlord_phone_arr
as
$v3
)
{
if
(
!
empty
(
$v3
)
&&
!
in_array
(
$v3
,
$landlord_phone_new_arr
))
{
if
(
!
empty
(
$v3
)
&&
!
in_array
(
$v3
,
$landlord_phone_new_arr
))
{
$landlord_phone_old
[]
=
$v3
;
$landlord_phone_old
[]
=
$v3
;
}
}
}
}
if
(
!
empty
(
$landlord_phone_old
))
{
if
(
!
empty
(
$landlord_phone_old
))
{
$remark
.=
',删除房东手机号:'
.
implode
(
','
,
$landlord_phone_old
);
$remark
.=
',删除房东手机号:'
.
implode
(
','
,
$landlord_phone_old
);
}
}
}
}
$m_operating
->
record
(
$agent_id
,
6
,
$remark
,
$data
[
'id'
]);
$m_operating
->
record
(
$agent_id
,
6
,
$remark
,
$data
[
'id'
]);
}
}
$house_id
=
$this
->
house
->
addHouse
(
$data
,
$agent_id
);
$house_id
=
$this
->
m_
house
->
addHouse
(
$data
,
$agent_id
);
if
(
empty
(
$house_id
))
{
if
(
empty
(
$house_id
))
{
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'新增或编辑商铺失败'
;
$result
[
'msg'
]
=
'新增或编辑商铺失败'
;
return
$result
;
return
$result
;
}
}
$houses_ext
=
new
GHousesExt
();
$house_img
=
new
GHousesImgs
();
$house_img
=
new
GHousesImgs
();
//商铺扩展字段
//商铺扩展字段
$houses
_ext
->
addHouseExt
(
$data
,
$house_id
,
$is_app
);
$this
->
m_house
_ext
->
addHouseExt
(
$data
,
$house_id
,
$is_app
);
//商铺图片
//商铺图片
if
(
$is_app
==
1
)
{
if
(
$is_app
==
1
)
{
$data
[
'cover'
]
=
json_decode
(
$data
[
'cover'
],
true
);
$data
[
'cover'
]
=
json_decode
(
$data
[
'cover'
],
true
);
$data
[
'slide_show'
]
=
json_decode
(
$data
[
'slide_show'
],
true
);
$data
[
'slide_show'
]
=
json_decode
(
$data
[
'slide_show'
],
true
);
$data
[
'exclusive_img'
]
=
json_decode
(
$data
[
'exclusive_img'
],
true
);
$data
[
'exclusive_img'
]
=
json_decode
(
$data
[
'exclusive_img'
],
true
);
}
}
if
(
$data
[
'id'
]
==
''
)
{
if
(
$data
[
'id'
]
==
''
)
{
$house_img
->
add
(
$data
,
$house_id
);
//只记录新增图片
$house_img
->
add
(
$data
,
$house_id
);
//只记录新增图片
}
else
{
}
else
{
$image_result
=
$house_img
->
edit
(
$data
,
$house_id
);
//编辑图片
$image_result
=
$house_img
->
edit
(
$data
,
$house_id
);
//编辑图片
if
(
$image_result
[
'status'
]
==
'fail'
)
{
if
(
$image_result
[
'status'
]
==
'fail'
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'编辑图片失败,'
.
$validate
->
getError
();
$result
[
'msg'
]
=
'编辑图片失败,'
.
$validate
->
getError
();
return
$result
;
return
$result
;
}
}
}
}
//案场权限人
//案场权限人
if
(
isset
(
$data
[
'agent_data'
]))
{
if
(
isset
(
$data
[
'agent_data'
]))
{
$result_agent_data
=
$this
->
releaseRelationship
(
$data
[
'agent_data'
],
$house_id
,
1
,
$agent_id
,
$data
[
'internal_title'
]);
$result_agent_data
=
$this
->
releaseRelationship
(
$data
[
'agent_data'
],
$house_id
,
1
,
$agent_id
,
$data
[
'internal_title'
]);
if
(
$result_agent_data
[
'status'
]
==
'fail'
)
{
if
(
$result_agent_data
[
'status'
]
==
'fail'
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'新增或编辑案场权限人失败,'
.
$result_agent_data
[
'msg'
];
$result
[
'msg'
]
=
'新增或编辑案场权限人失败,'
.
$result_agent_data
[
'msg'
];
return
$result
;
return
$result
;
}
}
}
}
//盘方
//盘方
if
(
isset
(
$data
[
'agent_dish'
]))
{
if
(
isset
(
$data
[
'agent_dish'
]))
{
$result_agent_dish
=
$this
->
releaseRelationship
(
$data
[
'agent_dish'
],
$house_id
,
2
,
$agent_id
,
$data
[
'internal_title'
]);
$result_agent_dish
=
$this
->
releaseRelationship
(
$data
[
'agent_dish'
],
$house_id
,
2
,
$agent_id
,
$data
[
'internal_title'
]);
if
(
$result_agent_dish
[
'status'
]
==
'fail'
)
{
if
(
$result_agent_dish
[
'status'
]
==
'fail'
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'新增或编辑盘方失败,'
.
$result_agent_dish
[
'msg'
];
$result
[
'msg'
]
=
'新增或编辑盘方失败,'
.
$result_agent_dish
[
'msg'
];
return
$result
;
return
$result
;
}
}
}
}
//独家方
//独家方
if
(
isset
(
$data
[
'exclusive_ids'
]))
{
if
(
isset
(
$data
[
'exclusive_ids'
]))
{
$result_exclusive_ids
=
$this
->
releaseRelationship
(
$data
[
'exclusive_ids'
],
$house_id
,
3
,
$agent_id
,
$data
[
'internal_title'
]);
$result_exclusive_ids
=
$this
->
releaseRelationship
(
$data
[
'exclusive_ids'
],
$house_id
,
3
,
$agent_id
,
$data
[
'internal_title'
]);
if
(
$result_exclusive_ids
[
'status'
]
==
'fail'
)
{
if
(
$result_exclusive_ids
[
'status'
]
==
'fail'
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'新增或编辑独家方失败,'
.
$result_exclusive_ids
[
'msg'
];
$result
[
'msg'
]
=
'新增或编辑独家方失败,'
.
$result_exclusive_ids
[
'msg'
];
return
$result
;
return
$result
;
}
}
}
}
if
(
!
empty
(
$data
[
'id'
]))
{
if
(
!
empty
(
$data
[
'id'
]))
{
//剩余商铺为0下架
//剩余商铺为0下架
if
(
empty
(
$data
[
'residue_num'
])
||
empty
(
$data
[
'total'
]))
{
if
(
empty
(
$data
[
'residue_num'
])
||
empty
(
$data
[
'total'
]))
{
$this
->
push
->
record
(
1
,
[
0
=>
$house_id
],
0
,
$agent_id
);
//记录推送信息
$this
->
push
->
record
(
1
,
[
0
=>
$house_id
],
0
,
$agent_id
);
//记录推送信息
}
}
}
}
$result
[
'data'
][
'house_id'
]
=
$house_id
;
$result
[
'data'
][
'house_id'
]
=
$house_id
;
$result
[
'data'
][
'internal_title'
]
=
$data
[
'internal_title'
];
$result
[
'data'
][
'internal_title'
]
=
$data
[
'internal_title'
];
$result
[
'status'
]
=
'successful'
;
$result
[
'status'
]
=
'successful'
;
$result
[
'msg'
]
=
'新增或编辑成功!'
;
$result
[
'msg'
]
=
'新增或编辑成功!'
;
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'内部错误:'
.
$e
->
getMessage
();
}
return
$result
;
return
$result
;
}
}
...
...
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