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
0238dcf1
Commit
0238dcf1
authored
Oct 18, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改经纪人状态
parent
213a208f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
2 deletions
+84
-2
Broker.php
application/index/controller/Broker.php
+19
-0
BrokerService.php
application/index/service/BrokerService.php
+63
-1
ADistrict.php
application/model/ADistrict.php
+1
-0
route.php
application/route.php
+1
-1
No files found.
application/index/controller/Broker.php
View file @
0238dcf1
...
@@ -585,6 +585,25 @@ class Broker extends Basic
...
@@ -585,6 +585,25 @@ class Broker extends Basic
}
}
/**
* 处理经纪人状态
*
* @return \think\Response
*/
public
function
updateStatusV2
()
{
$result
[
'code'
]
=
200
;
$result
[
'msg'
]
=
""
;
$broker_service
=
new
BrokerService
();
$data
=
$broker_service
->
updateStatus
(
$this
->
params
,
$this
->
userId
);
if
(
$data
[
'status'
]
==
'fail'
)
{
$result
[
'msg'
]
=
$data
[
'msg'
];
}
return
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
]);
}
/**
/**
* 批量变更角色
* 批量变更角色
*
*
...
...
application/index/service/BrokerService.php
View file @
0238dcf1
...
@@ -9,8 +9,11 @@
...
@@ -9,8 +9,11 @@
namespace
app\index\service
;
namespace
app\index\service
;
use
app\api_broker\service\CallPhoneService
;
use
app\api_broker\service\PushMessageService
;
use
app\index\validate\AAgentValidate
;
use
app\index\validate\AAgentValidate
;
use
app\model\AAgents
;
use
app\model\AAgents
;
use
app\model\ABindingDevice
;
use
app\model\ADistrict
;
use
app\model\ADistrict
;
class
BrokerService
class
BrokerService
...
@@ -34,7 +37,7 @@ class BrokerService
...
@@ -34,7 +37,7 @@ class BrokerService
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$validate
=
new
AAgentValidate
();
$validate
=
new
AAgentValidate
();
$m_district
=
new
ADistrict
();
$m_district
=
new
ADistrict
();
$data
[
'site_id'
]
=
$m_district
->
getDistrictKeyById
(
'site_id'
,
[
'id'
=>
$data
[
'district_id'
]]);
$data
[
'site_id'
]
=
$m_district
->
getDistrictKeyById
(
'site_id'
,
[
'id'
=>
$data
[
'district_id'
]]);
if
(
empty
(
$data
[
'id'
]))
{
if
(
empty
(
$data
[
'id'
]))
{
$check
=
$validate
->
scene
(
'add'
)
->
check
(
$data
);
$check
=
$validate
->
scene
(
'add'
)
->
check
(
$data
);
...
@@ -90,4 +93,62 @@ class BrokerService
...
@@ -90,4 +93,62 @@ class BrokerService
return
$result
;
return
$result
;
}
}
/**
* 处理经纪人状态
*
* @param array $data
* @param int $operation_id
* @return mixed
*/
public
function
updateStatus
(
array
$data
,
int
$operation_id
)
{
$result
[
'status'
]
=
'successful'
;
$save_data
[
'status'
]
=
$data
[
'status'
];
$save_data
[
'id'
]
=
$data
[
'id'
];
$id
=
$this
->
m_agent
->
saveAgent
(
$save_data
);
if
(
$id
<
0
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'修改失败'
;
return
$result
;
}
if
(
$data
[
'status'
]
!=
0
)
{
$is_forbidden
=
1
;
}
else
{
$is_forbidden
=
0
;
}
//同时修改设备绑定表
try
{
$m_agent_device
=
new
ABindingDevice
();
$m_agent_device
->
updateDate
([
'is_forbidden'
=>
$is_forbidden
],
[
'agent_id'
=>
$data
[
'id'
]]);
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'设备解绑失败'
;
return
$result
;
}
if
(
$data
[
'status'
]
!=
0
)
{
$where
[
'a.id'
]
=
$data
[
'id'
];
$where
[
'b.status'
]
=
1
;
$agent_phone
=
$this
->
m_agent
->
getAgentCallPhone
(
'b.phone_a,b.phone_b,c.phone_x'
,
$where
);
if
(
!
empty
(
$agent_phone
[
'data'
])
&&
$agent_phone
[
'status'
]
!=
'fail'
)
{
$call
=
new
CallPhoneService
();
foreach
(
$agent_phone
[
'data'
]
as
$k
=>
$v
)
{
$call
->
agentsUnBind
(
$v
[
'phone_a'
],
$v
[
'phone_b'
],
$v
[
'phone_x'
],
0
);
}
}
$push
=
new
PushMessageService
();
$message_data
[
'message'
]
=
'你的账号被冻结。'
;
$message_data
[
'agent_id'
]
=
$data
[
'id'
];
$push
->
record
(
4
,
0
,
0
,
$operation_id
,
$message_data
);
}
return
$result
;
}
}
}
\ No newline at end of file
application/model/ADistrict.php
View file @
0238dcf1
...
@@ -106,6 +106,7 @@ class ADistrict extends BaseModel
...
@@ -106,6 +106,7 @@ class ADistrict extends BaseModel
if
(
$id
)
{
if
(
$id
)
{
$district
=
$this
->
field
(
'district_name,site_id'
)
->
where
(
'id'
,
$id
)
->
find
();
$district
=
$this
->
field
(
'district_name,site_id'
)
->
where
(
'id'
,
$id
)
->
find
();
$data
[
'district_name'
]
=
$district
[
'district_name'
];
$data
[
'district_name'
]
=
$district
[
'district_name'
];
$data
[
'site_id'
]
=
$district
[
'site_id'
];
$data
[
'city'
]
=
Db
::
table
(
'a_site'
)
->
where
(
'id'
,
$district
[
'site_id'
])
->
value
(
'city'
);
$data
[
'city'
]
=
Db
::
table
(
'a_site'
)
->
where
(
'id'
,
$district
[
'site_id'
])
->
value
(
'city'
);
$agents
=
Db
::
table
(
'a_agents'
)
->
field
(
'name,phone'
)
$agents
=
Db
::
table
(
'a_agents'
)
->
field
(
'name,phone'
)
->
where
([
->
where
([
...
...
application/route.php
View file @
0238dcf1
...
@@ -147,7 +147,7 @@ Route::group('index', [
...
@@ -147,7 +147,7 @@ Route::group('index', [
'saveAgentIndex'
=>
[
'index/broker/saveAgentIndex'
,
[
'method'
=>
'get'
]
],
//编辑列表列表界面
'saveAgentIndex'
=>
[
'index/broker/saveAgentIndex'
,
[
'method'
=>
'get'
]
],
//编辑列表列表界面
'AgentList'
=>
[
'index/broker/AgentList'
,
[
'method'
=>
'get'
]
],
//首页列表【接口】
'AgentList'
=>
[
'index/broker/AgentList'
,
[
'method'
=>
'get'
]
],
//首页列表【接口】
'saveAgent'
=>
[
'index/broker/saveAgentV2'
,
[
'method'
=>
'get|post'
]
],
//修改经纪人【接口】
'saveAgent'
=>
[
'index/broker/saveAgentV2'
,
[
'method'
=>
'get|post'
]
],
//修改经纪人【接口】
'updateStatus'
=>
[
'index/broker/updateStatus'
,
[
'method'
=>
'post'
]
],
//状态修改【接口】
'updateStatus'
=>
[
'index/broker/updateStatus
V2
'
,
[
'method'
=>
'post'
]
],
//状态修改【接口】
'updateRole'
=>
[
'index/broker/updateRole'
,
[
'method'
=>
'post'
]
],
//经纪人角色修改【接口】
'updateRole'
=>
[
'index/broker/updateRole'
,
[
'method'
=>
'post'
]
],
//经纪人角色修改【接口】
'deviceList'
=>
[
'index/broker/deviceList'
,
[
'method'
=>
'post|get'
]
],
//经纪人设备id绑定列表
'deviceList'
=>
[
'index/broker/deviceList'
,
[
'method'
=>
'post|get'
]
],
//经纪人设备id绑定列表
'updateDevice'
=>
[
'index/broker/updateDevice'
,
[
'method'
=>
'post|get'
]
],
//解绑或绑定经纪人设备id
'updateDevice'
=>
[
'index/broker/updateDevice'
,
[
'method'
=>
'post|get'
]
],
//解绑或绑定经纪人设备id
...
...
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