Commit 0a9ea7d3 authored by hujun's avatar hujun

容联云定时解除绑定关系

parent d75689b9
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
namespace app\task\controller; namespace app\task\controller;
use app\api_broker\untils\PlsDemo; use app\api_broker\untils\PlsDemo;
use app\api_broker\untils\RongDemo;
use app\model\AliYunSecretReport; use app\model\AliYunSecretReport;
use app\model\BindingPhone; use app\model\BindingPhone;
use app\model\SecretReport; use app\model\SecretReport;
...@@ -86,7 +87,7 @@ class PrivacyNumber ...@@ -86,7 +87,7 @@ class PrivacyNumber
} }
} }
return ; return;
} }
/** /**
...@@ -100,33 +101,33 @@ class PrivacyNumber ...@@ -100,33 +101,33 @@ class PrivacyNumber
{ {
$m_bind = new BindingPhone(); $m_bind = new BindingPhone();
$fields = 'a.id,aliYun_phone_id,expiry_date,phone_x,phone_a,phone_b,subsId'; $fields = 'a.id,aliYun_phone_id,expiry_date,phone_x,phone_a,phone_b,subsId,a.type,a.mappingId';
$where['a.status'] = 1; $where['a.status'] = 1;
$where['b.type'] = 1; $where['a.expiry_date'] = [ '<=', date('Y-m-d') . ' 23:59:59' ];
$bind_data = $m_bind->getBindingPhoneList($fields, $where); $bind_data = $m_bind->getBindingPhoneList($fields, $where);
$time = strtotime(date('Y-m-d')); //今天0点
$binding_phone_id = []; $binding_phone_id = [];
$phone_id = []; $phone_id = [];
$bind = new BindingPhone(); $bind = new BindingPhone();
foreach ($bind_data as $k => $v) { foreach ($bind_data as $k => $v) {
$date = strtotime(date('Y-m-d', strtotime($v['expiry_date'])));
//解除绑定 //解除绑定
if ($date <= $time) { if ($v['type'] == 1 && !empty($v['subsId'])) {
$subsId = $bind->getSubsId($v['phone_x'], $v['phone_a'], $v['phone_b'], 1); //释放阿里云隐私号码
$result = PlsDemo::unbindSubscription($v['subsId'], $v['phone_x']);
if (empty($subsId)) {
continue;
}
$result = PlsDemo::unbindSubscription($subsId, $v['phone_x']);
if ($result->Message == 'OK') { if ($result->Message == 'OK') {
$bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b'], $result->RequestId); $bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b'], $result->RequestId);
$binding_phone_id[$k] = $v['id']; $binding_phone_id[$k] = $v['id'];
$phone_id[$k] = $v['aliYun_phone_id']; $phone_id[$k] = $v['aliYun_phone_id'];
} }
} elseif ($v['type'] == 2 && !empty($v['mappingId'])) {
//释放容联云隐私号码
$tong_xun = new RongDemo();
$result = $tong_xun->releaseNumber($v['mappingId']);/*解绑*/
if ($result['statusCode'] == '000000') {
$bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b']);
$binding_phone_id[$k] = $v['id'];
$phone_id[$k] = $v['aliYun_phone_id'];
}
} }
} }
...@@ -231,6 +232,6 @@ class PrivacyNumber ...@@ -231,6 +232,6 @@ class PrivacyNumber
$m_bind->unBindTable($v['id'], $v['aliYun_phone_id']); $m_bind->unBindTable($v['id'], $v['aliYun_phone_id']);
} }
} }
return ; return;
} }
} }
\ 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