Commit cb5d571d authored by hujun's avatar hujun

冻结解绑号码

parent e3ec27b3
...@@ -21,11 +21,13 @@ ...@@ -21,11 +21,13 @@
namespace app\index\controller; namespace app\index\controller;
use app\api_broker\service\CallPhoneService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\model\AAgents; use app\model\AAgents;
use app\model\ABindingDevice; use app\model\ABindingDevice;
use app\model\Agents; use app\model\Agents;
use app\model\AStore; use app\model\AStore;
use app\model\BindingPhone;
use app\model\Evaluate; use app\model\Evaluate;
use app\model\Regions; use app\model\Regions;
use think\Exception; use think\Exception;
...@@ -257,7 +259,7 @@ class Agent extends Basic ...@@ -257,7 +259,7 @@ class Agent extends Basic
public function updateStatus() public function updateStatus()
{ {
$data = $this->request->param(); $data = $this->request->param();
$ids = $data['ids']; $ids = 5740;
//排除超级管理员 //排除超级管理员
if (is_array($ids)) { if (is_array($ids)) {
if (in_array(1, $ids)) { if (in_array(1, $ids)) {
...@@ -281,6 +283,20 @@ class Agent extends Basic ...@@ -281,6 +283,20 @@ class Agent extends Basic
//同时修改设备绑定表 //同时修改设备绑定表
$m_agent_device = new ABindingDevice(); $m_agent_device = new ABindingDevice();
$m_agent_device->updateDate(['is_forbidden'=>$is_forbidden], ['agent_id'=>$ids]); $m_agent_device->updateDate(['is_forbidden'=>$is_forbidden], ['agent_id'=>$ids]);
if ($data['status'] == 1) {
$where['a.id'] = $ids;
$where['b.status'] = 1;
$agent_phone = $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 as $k=>$v) {
$call->agentsUnBind($v['phone_a'], $v['phone_b'], $v['phone_x'], 0);
}
}
}
return $this->response(200, '成功', $data); return $this->response(200, '成功', $data);
} else { } else {
return $this->response(100, '失败', $data); return $this->response(100, '失败', $data);
......
...@@ -1123,4 +1123,29 @@ class AAgents extends BaseModel ...@@ -1123,4 +1123,29 @@ class AAgents extends BaseModel
} }
return $data; return $data;
} }
/**
* 获取绑定号码
*
* @param $field
* @param $where
* @return mixed
*/
public function getAgentCallPhone($field, $where) {
try {
$result['data'] = $this->alias('a')
->field($field)
->join('aliYun_binding_phone b', 'a.phone = b.phone_a', 'left')
->join('aliYun_phone c', 'b.aliYun_phone_id = c.id', 'left')
->where($where)
->select();
$result['status'] = 'successful';
} catch (\Exception $e) {
$result['data'] = [];
$result['status'] = 'fail';
$result['msg'] = $e->getMessage();
}
return $result;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment