Commit 07d6767e authored by hujun's avatar hujun

定时任务同步删除拨号redis缓存

parent 0b375e85
...@@ -12,6 +12,7 @@ use app\api_broker\service\CallPhoneService; ...@@ -12,6 +12,7 @@ use app\api_broker\service\CallPhoneService;
use app\api_broker\service\ClientService; use app\api_broker\service\ClientService;
use app\api_broker\untils\PlsDemo; use app\api_broker\untils\PlsDemo;
use app\api_broker\untils\RongDemo; use app\api_broker\untils\RongDemo;
use app\extra\RedisExt;
use app\model\AliYunSecretReport; use app\model\AliYunSecretReport;
use app\model\BindingPhone; use app\model\BindingPhone;
use app\model\SecretReport; use app\model\SecretReport;
...@@ -151,6 +152,7 @@ class PrivacyNumber ...@@ -151,6 +152,7 @@ class PrivacyNumber
$binding_phone_id = []; $binding_phone_id = [];
$phone_id = []; $phone_id = [];
$bind = new BindingPhone(); $bind = new BindingPhone();
$redis = RedisExt::getRedis();
foreach ($bind_data['data'] as $k => $v) { foreach ($bind_data['data'] as $k => $v) {
//解除绑定 //解除绑定
if ($v['type'] == 1 && !empty($v['subsId'])) { if ($v['type'] == 1 && !empty($v['subsId'])) {
...@@ -160,6 +162,9 @@ class PrivacyNumber ...@@ -160,6 +162,9 @@ class PrivacyNumber
$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'];
$call_key = 'call_'.$v['phone_a'].'_'.$v['phone_b'].'_1';
$redis->del($call_key);
} }
} elseif ($v['type'] == 2 && !empty($v['mappingId'])) { } elseif ($v['type'] == 2 && !empty($v['mappingId'])) {
//释放容联云隐私号码 //释放容联云隐私号码
...@@ -169,6 +174,9 @@ class PrivacyNumber ...@@ -169,6 +174,9 @@ class PrivacyNumber
$bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b']); $bind->unBind($v['phone_x'], $v['phone_a'], $v['phone_b']);
$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'];
$call_key = 'call_'.$v['phone_a'].'_'.$v['phone_b'].'_2';
$redis->del($call_key);
} else { } else {
$yun_result = $tong_xun->getBindInfo($v['phone_a'], $v['phone_b'], $v['phone_x'], $v['mappingId']); $yun_result = $tong_xun->getBindInfo($v['phone_a'], $v['phone_b'], $v['phone_x'], $v['mappingId']);
if (empty($yun_result['data']['mappingId'])) { if (empty($yun_result['data']['mappingId'])) {
...@@ -287,9 +295,13 @@ class PrivacyNumber ...@@ -287,9 +295,13 @@ class PrivacyNumber
$where['a.status'] = 1; $where['a.status'] = 1;
$where['a.expiry_date'] = [ '<', date('Y-m-d H:i:s') ]; $where['a.expiry_date'] = [ '<', date('Y-m-d H:i:s') ];
$select_data = $m_bind->getBindingPhoneList('a.id,a.aliYun_phone_id', $where); $select_data = $m_bind->getBindingPhoneList('a.id,a.aliYun_phone_id,a.phone_a,a.phone_b,a.type', $where);
$redis = RedisExt::getRedis();
foreach ($select_data['data'] as $k => $v) { foreach ($select_data['data'] as $k => $v) {
$m_bind->unBindTable($v['id'], $v['aliYun_phone_id']); $m_bind->unBindTable($v['id'], $v['aliYun_phone_id']);
$call_key = 'call_'.$v['phone_a'].'_'.$v['phone_b'].'_'.$v['type'];
$redis->del($call_key);
} }
return; return;
} }
......
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