Commit d2da715d authored by hujun's avatar hujun

容联云绑定号码检测

parent 39894d03
......@@ -67,7 +67,7 @@ class CallPhoneService
* @param int $house_id
* @return mixed
*/
public function bindAXB($phone_a, $phone_b, $record = true, int $user_id, int $agent_id, string $agent_name, int $landlord, int $house_id)
public function bindAXB($phone_a, $phone_b, $record = true, int $user_id, $agent_id, string $agent_name, int $landlord, int $house_id)
{
$result['status'] = 'failed';
......@@ -264,15 +264,16 @@ class CallPhoneService
/*容联云*/
$mappingId = $phone->getSubsId($this->phone_x, $this->phone_a, $this->phone_b, 1, 'mappingId');
$yun_tong_xun = new RongDemo();
if ($mappingId) {
if ($mappingId) {
$result = $yun_tong_xun->releaseNumber($mappingId);/*解绑*/
if ($result['statusCode'] == '000000') {
$phone->unBind($this->phone_x, $this->phone_a, $this->phone_b);
} else {
$data['status'] = 'failed';
$data['msg'] = '解除失败,如果需要继续与客户沟通,请联系运营!';
$yun_result = $yun_tong_xun->getBindInfo($this->phone_a, $this->phone_b, $this->phone_x, $mappingId);
if (empty($yun_result['data']['mappingId'])) {
$phone->unBind($this->phone_x, $this->phone_a, $this->phone_b);
}
}
} else {
$data['msg'] = '没有号码绑定关系,请忽略!。';
......
......@@ -224,4 +224,33 @@ class RongDemo
}
return $msg;
}
/**
* 检查AXB绑定状态
*
* @param $aNumber
* @param $bNumber
* @param $xNumber
* @param $mappingId
* @return mixed
*/
public function getBindInfo($aNumber, $bNumber, $xNumber, $mappingId)
{
$data = $this->components;
$time = date('YmdHis', time());
$sign = $this->sigParameter($time); /*签名*/
$url = $this->url('axb', 'query', 'cu01', $sign);/*url*/
$Authorization = $this->Authorization($time);/*认证信息*/
$post_data = [
'appId' => $data['appId'],
'mappingId' => $mappingId,
'aNumber' => $aNumber,
'xNumber' => $xNumber,
'bNumber' => $bNumber
];
$result = json_decode($this->sendCurl($url, $post_data, $Authorization), true);
$result['code_msg'] = $this->getCodeString($result['statusCode']);
return $result;
}
}
\ No newline at end of file
......@@ -18,9 +18,9 @@ class BindingPhone extends BaseModel
*
* @param $phone_x
* @param $phone_a
* @param $phone_b
* @param $phoneId
* @param string $phone_b
* @param int $status
* @param string $phoneId
* @return bool|mixed
*/
public function getSubsId($phone_x, $phone_a, $phone_b = '', $status = 0, $phoneId = 'subsId')
......
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