|
|
@ -10,6 +10,7 @@ namespace frontend\controllers; |
|
|
|
|
|
|
|
|
|
|
|
use common\models\FixCarT; |
|
|
|
use common\models\FixCarT; |
|
|
|
use common\models\UserT; |
|
|
|
use common\models\UserT; |
|
|
|
|
|
|
|
use GuzzleHttp\Client; |
|
|
|
use yii\base\Controller; |
|
|
|
use yii\base\Controller; |
|
|
|
use common\libs\MyLib; |
|
|
|
use common\libs\MyLib; |
|
|
|
use common\models\AppointmentT; |
|
|
|
use common\models\AppointmentT; |
|
|
@ -319,7 +320,6 @@ public function actionDownload(){ |
|
|
|
$phone = $request->post('phone',''); |
|
|
|
$phone = $request->post('phone',''); |
|
|
|
$is_double = $request->post('is_double',0); |
|
|
|
$is_double = $request->post('is_double',0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($user_id == 0) { |
|
|
|
if($user_id == 0) { |
|
|
|
$result['msg'] = '请输入人员名称!'; |
|
|
|
$result['msg'] = '请输入人员名称!'; |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
@ -330,14 +330,33 @@ public function actionDownload(){ |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tran = NetworkPhoneAssignT::getDb()->beginTransaction(); |
|
|
|
$tran = NetworkPhoneAssignT::getDb()->beginTransaction(); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
$row = null; |
|
|
|
$row = null; |
|
|
|
if($id > 0) { |
|
|
|
if($id > 0) { |
|
|
|
$row = NetworkPhoneAssignT::findOne(['id'=>$id]); |
|
|
|
$row = NetworkPhoneAssignT::findOne(['id'=>$id]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$url = Yii::$app->params['userPanel']['phone_url']; |
|
|
|
|
|
|
|
$token = Yii::$app->params['userPanel']['token']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$params = [ |
|
|
|
|
|
|
|
'token' => $token, |
|
|
|
|
|
|
|
'op' => 'edit', |
|
|
|
|
|
|
|
'phone' => $phone, |
|
|
|
|
|
|
|
'old_phone' => $row->phone |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
$client = new Client(); |
|
|
|
|
|
|
|
$res = $client->request('POST', $url, [ |
|
|
|
|
|
|
|
'form_params' => $params, |
|
|
|
|
|
|
|
'http_errors' => false, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
if($res->getStatusCode() == 200) { |
|
|
|
|
|
|
|
$obj = json_decode($res->getBody()); |
|
|
|
|
|
|
|
if($obj->code == 400) { |
|
|
|
|
|
|
|
$result['msg'] = $obj->msg; |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if($is_double == 0) { |
|
|
|
if($is_double == 0) { |
|
|
|
$t = NetworkPhoneAssignT::findOne(['phone' => $phone]); |
|
|
|
$t = NetworkPhoneAssignT::findOne(['phone' => $phone]); |
|
|
@ -346,6 +365,26 @@ public function actionDownload(){ |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$url = Yii::$app->params['userPanel']['phone_url']; |
|
|
|
|
|
|
|
$token = Yii::$app->params['userPanel']['token']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$params = [ |
|
|
|
|
|
|
|
'token' => $token, |
|
|
|
|
|
|
|
'op' => 'add', |
|
|
|
|
|
|
|
'phone' => $phone |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
$client = new Client(); |
|
|
|
|
|
|
|
$res = $client->request('POST', $url, [ |
|
|
|
|
|
|
|
'form_params' => $params, |
|
|
|
|
|
|
|
'http_errors' => false, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
if($res->getStatusCode() == 200) { |
|
|
|
|
|
|
|
$obj = json_decode($res->getBody()); |
|
|
|
|
|
|
|
if($obj->code == 400) { |
|
|
|
|
|
|
|
$result['msg'] = $obj->msg; |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
$row = new NetworkPhoneAssignT(); |
|
|
|
$row = new NetworkPhoneAssignT(); |
|
|
|
} |
|
|
|
} |
|
|
|
$row->user_id = $user_id; |
|
|
|
$row->user_id = $user_id; |
|
|
@ -386,6 +425,27 @@ public function actionDownload(){ |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
$row = NetworkPhoneAssignT::findOne(['id'=>$id]); |
|
|
|
$row = NetworkPhoneAssignT::findOne(['id'=>$id]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$url = Yii::$app->params['userPanel']['phone_url']; |
|
|
|
|
|
|
|
$token = Yii::$app->params['userPanel']['token']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$params = [ |
|
|
|
|
|
|
|
'token' => $token, |
|
|
|
|
|
|
|
'op' => 'delete', |
|
|
|
|
|
|
|
'phone' => $row->phone |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
$client = new Client(); |
|
|
|
|
|
|
|
$res = $client->request('POST', $url, [ |
|
|
|
|
|
|
|
'form_params' => $params, |
|
|
|
|
|
|
|
'http_errors' => false, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
if($res->getStatusCode() == 200) { |
|
|
|
|
|
|
|
$obj = json_decode($res->getBody()); |
|
|
|
|
|
|
|
if($obj->code == 400) { |
|
|
|
|
|
|
|
$result['msg'] = $obj->msg; |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
$row->delete(); |
|
|
|
$row->delete(); |
|
|
|
|
|
|
|
|
|
|
|
$result['success'] = true; |
|
|
|
$result['success'] = true; |
|
|
@ -394,7 +454,7 @@ public function actionDownload(){ |
|
|
|
$tran->commit(); |
|
|
|
$tran->commit(); |
|
|
|
} catch(\Exception $e) { |
|
|
|
} catch(\Exception $e) { |
|
|
|
$tran->rollBack(); |
|
|
|
$tran->rollBack(); |
|
|
|
throw $e; |
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -412,7 +472,6 @@ public function actionDownload(){ |
|
|
|
$info = new NetworkPhoneSubT(); |
|
|
|
$info = new NetworkPhoneSubT(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $this->render('sub-edit',[ |
|
|
|
return $this->render('sub-edit',[ |
|
|
|
'info' => $info, |
|
|
|
'info' => $info, |
|
|
|
'assign_id'=>$assign_id |
|
|
|
'assign_id'=>$assign_id |
|
|
@ -434,13 +493,12 @@ public function actionDownload(){ |
|
|
|
$is_called = $request->post('is_called'); |
|
|
|
$is_called = $request->post('is_called'); |
|
|
|
$is_double = $request->post('is_double'); |
|
|
|
$is_double = $request->post('is_double'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($phone == '') { |
|
|
|
if($phone == '') { |
|
|
|
$result['msg'] = '请输入电话号码!'; |
|
|
|
$result['msg'] = '请输入电话号码!'; |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$phone_info = NetworkPhoneAssignT::findOne(['id'=>$assign_id]); |
|
|
|
|
|
|
|
|
|
|
|
$tran = NetworkPhoneSubT::getDb()->beginTransaction(); |
|
|
|
$tran = NetworkPhoneSubT::getDb()->beginTransaction(); |
|
|
|
|
|
|
|
|
|
|
@ -448,6 +506,28 @@ public function actionDownload(){ |
|
|
|
$row = null; |
|
|
|
$row = null; |
|
|
|
if($id > 0) { |
|
|
|
if($id > 0) { |
|
|
|
$row = NetworkPhoneSubT::findOne(['id'=>$id]); |
|
|
|
$row = NetworkPhoneSubT::findOne(['id'=>$id]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$url = Yii::$app->params['userPanel']['phone_url']; |
|
|
|
|
|
|
|
$token = Yii::$app->params['userPanel']['token']; |
|
|
|
|
|
|
|
$params = [ |
|
|
|
|
|
|
|
'token' => $token, |
|
|
|
|
|
|
|
'op' => 'sub_edit', |
|
|
|
|
|
|
|
'phone' => $phone_info->phone, |
|
|
|
|
|
|
|
'sub_phone' => $phone, |
|
|
|
|
|
|
|
'old_sub_phone' => $row->phone |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
$client = new Client(); |
|
|
|
|
|
|
|
$res = $client->request('POST', $url, [ |
|
|
|
|
|
|
|
'form_params' => $params, |
|
|
|
|
|
|
|
'http_errors' => false, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
if($res->getStatusCode() == 200) { |
|
|
|
|
|
|
|
$obj = json_decode($res->getBody()); |
|
|
|
|
|
|
|
if($obj->code == 400) { |
|
|
|
|
|
|
|
$result['msg'] = $obj->msg; |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if($is_double == 0) { |
|
|
|
if($is_double == 0) { |
|
|
|
$t = NetworkPhoneSubT |
|
|
|
$t = NetworkPhoneSubT |
|
|
@ -457,6 +537,28 @@ public function actionDownload(){ |
|
|
|
return $result; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$url = Yii::$app->params['userPanel']['phone_url']; |
|
|
|
|
|
|
|
$token = Yii::$app->params['userPanel']['token']; |
|
|
|
|
|
|
|
$params = [ |
|
|
|
|
|
|
|
'token' => $token, |
|
|
|
|
|
|
|
'op' => 'sub_add', |
|
|
|
|
|
|
|
'phone' => $phone_info->phone, |
|
|
|
|
|
|
|
'sub_phone' => $phone |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
$client = new Client(); |
|
|
|
|
|
|
|
$res = $client->request('POST', $url, [ |
|
|
|
|
|
|
|
'form_params' => $params, |
|
|
|
|
|
|
|
'http_errors' => false, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
if($res->getStatusCode() == 200) { |
|
|
|
|
|
|
|
$obj = json_decode($res->getBody()); |
|
|
|
|
|
|
|
if($obj->code == 400) { |
|
|
|
|
|
|
|
$result['msg'] = $obj->msg; |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$row = new NetworkPhoneSubT(); |
|
|
|
$row = new NetworkPhoneSubT(); |
|
|
|
} |
|
|
|
} |
|
|
|
$row->assign_id = $assign_id; |
|
|
|
$row->assign_id = $assign_id; |
|
|
@ -467,7 +569,7 @@ public function actionDownload(){ |
|
|
|
$tran->commit(); |
|
|
|
$tran->commit(); |
|
|
|
} catch(\Exception $e) { |
|
|
|
} catch(\Exception $e) { |
|
|
|
$tran->rollBack(); |
|
|
|
$tran->rollBack(); |
|
|
|
throw $e; |
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$result['success'] = true; |
|
|
|
$result['success'] = true; |
|
|
@ -492,6 +594,26 @@ public function actionDownload(){ |
|
|
|
try { |
|
|
|
try { |
|
|
|
$row = NetworkPhoneSubT::findOne(['id'=>$id]); |
|
|
|
$row = NetworkPhoneSubT::findOne(['id'=>$id]); |
|
|
|
if($row->bind_id == ''){ |
|
|
|
if($row->bind_id == ''){ |
|
|
|
|
|
|
|
$url = Yii::$app->params['userPanel']['phone_url']; |
|
|
|
|
|
|
|
$token = Yii::$app->params['userPanel']['token']; |
|
|
|
|
|
|
|
$params = [ |
|
|
|
|
|
|
|
'token' => $token, |
|
|
|
|
|
|
|
'op' => 'sub_delete', |
|
|
|
|
|
|
|
'sub_phone' => $row->phone |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
$client = new Client(); |
|
|
|
|
|
|
|
$res = $client->request('POST', $url, [ |
|
|
|
|
|
|
|
'form_params' => $params, |
|
|
|
|
|
|
|
'http_errors' => false, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
if($res->getStatusCode() == 200) { |
|
|
|
|
|
|
|
$obj = json_decode($res->getBody()); |
|
|
|
|
|
|
|
if($obj->code == 400) { |
|
|
|
|
|
|
|
$result['msg'] = $obj->msg; |
|
|
|
|
|
|
|
return $result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$row->delete(); |
|
|
|
$row->delete(); |
|
|
|
|
|
|
|
|
|
|
|
$result['success'] = true; |
|
|
|
$result['success'] = true; |
|
|
@ -502,7 +624,7 @@ public function actionDownload(){ |
|
|
|
$tran->commit(); |
|
|
|
$tran->commit(); |
|
|
|
} catch(\Exception $e) { |
|
|
|
} catch(\Exception $e) { |
|
|
|
$tran->rollBack(); |
|
|
|
$tran->rollBack(); |
|
|
|
throw $e; |
|
|
|
$result['msg'] = $e->getMessage(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|