Commit 19cd37b7 authored by hujun's avatar hujun

隐私号码优化

parent c7c519d8
......@@ -318,12 +318,9 @@ class CallPhoneService
}
/**
* 容联云
* 容联云号码绑定
*
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function yunTongXun()
{
......@@ -336,33 +333,32 @@ class CallPhoneService
}
$aliYunPhone = new AliYunPhone();
$phone_x = $aliYunPhone->getAliYunPhone($this->phone_a, $this->phone_b, $this->is_privacy); //获取未绑定隐号
$result = $yun_tong_xun->setNumber($this->phone_a, $this->phone_b, $phone_x['phone_x'], $phone_x['area'], $this->expiry_date, $record);
$phone_x = $aliYunPhone->getAliYunPhoneAll($this->phone_a, $this->phone_b, $this->is_privacy, [], $this->city); //获取未绑定隐号
$result = $yun_tong_xun->setNumber($this->phone_a, $this->phone_b, $phone_x['data']['phone_x'], $phone_x['data']['area'], $this->expiry_date, $record);
/*绑定成功*/
if ($result['statusCode'] == '000000') {
$data['status'] = 'success';
$data['msg'] = '绑定成功。';
$data['phone'] = $phone_x['phone_x'];
$data['phone'] = $phone_x['data']['phone_x'];
$this->mapping_id = $result['data']['mappingId'];
} else {
$phone_x_arr[] = $phone_x['phone_x']; //剔除绑定失败的中间号
$phone_x_arr[] = $phone_x['data']['phone_x']; //剔除绑定失败的中间号
//尝试5次再绑定
for ($i = 0; $i < 5; $i++) {
$phone_x = $aliYunPhone->getAliYunPhone($this->phone_a, $this->phone_b, $this->is_privacy, $phone_x_arr); //获取未绑定隐号
$result = $yun_tong_xun->setNumber($this->phone_a, $this->phone_b, $phone_x['phone_x'], $phone_x['area'], $this->expiry_date, $record);
$phone_x = $aliYunPhone->getAliYunPhoneAll($this->phone_a, $this->phone_b, $this->is_privacy, $phone_x_arr); //获取未绑定隐号
$result = $yun_tong_xun->setNumber($this->phone_a, $this->phone_b, $phone_x['data']['phone_x'], $phone_x['data']['area'], $this->expiry_date, $record);
if ($result['statusCode'] == '000000') {
$data['status'] = 'success';
$data['msg'] = '绑定成功。';
$data['phone'] = $phone_x['phone_x'];
$data['phone'] = $phone_x['data']['phone_x'];
$this->mapping_id = $result['data']['mappingId'];
break;
} else {
$phone_x_arr[] = $phone_x['phone_x']; //剔除绑定失败的中间号
$phone_x_arr[] = $phone_x['data']['phone_x']; //剔除绑定失败的中间号
}
}
......
......@@ -66,14 +66,27 @@ class AliYunPhone extends BaseModel
* @param $phone_b
* @param int $type
* @param array $phone_x
* @param $city
* @return mixed
*/
public function getAliYunPhoneAll($phone_a, $phone_b, $type = 1, $phone_x = [])
public function getAliYunPhoneAll($phone_a, $phone_b, $type = 1, $phone_x = [], $city)
{
$result['data'] = [];
$m_bind = new BindingPhone();
// if ($city == '上海') {
// $where_bind_a['area'] = '021';
// $where_bind_b['area'] = '021';
// $where_phone['area'] = '021';
// }
//
// if ($city == '杭州') {
// $where_bind_a['area'] = '0571';
// $where_bind_b['area'] = '0571';
// $where_phone['area'] = '0571';
// }
//尝试多次绑定,去除已经绑定失败的号码
if (!empty($phone_x)) {
$where_bind_a['b.phone_x'] = [ 'NOT IN', $phone_x];
......@@ -87,10 +100,10 @@ class AliYunPhone extends BaseModel
$id_arr_a = $m_bind->getBindingPhoneList('b.id', $where_bind_a);
//找到phone_b绑定的隐私号码
$where_bind_b['a.phone_a'] = $phone_b;
$where_bind_b['a.phone_b'] = $phone_b;
$where_bind_b['a.status'] = 1;
$where_bind_b['b.type'] = $type;
$id_arr_b = $m_bind->getBindingPhoneList('b.id', $where_bind_a);
$id_arr_b = $m_bind->getBindingPhoneList('b.id', $where_bind_b);
$id_merge = array_merge($id_arr_a['data'], $id_arr_b['data']);
......@@ -101,6 +114,7 @@ class AliYunPhone extends BaseModel
$id = empty($id) ? 0 : $id;
$where_phone['status'] = 0;
$where_phone['type'] = $type;
$where_phone['bind_num'] = ['<', 201];
try {
if (empty($id)) {
......
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