Commit edb22d2f authored by zw's avatar zw

Merge branch 'test' of https://gitee.com/zwyjjc/tl_estate into test

parents 6f37f0e4 f6c45d08
...@@ -64,4 +64,13 @@ class AAgentsPhone extends BaseModel ...@@ -64,4 +64,13 @@ class AAgentsPhone extends BaseModel
return $result; return $result;
} }
/**
* @param $where
* @param $fields
* @return mixed
*/
public function getAgentsByWhere($where, $fields)
{
return $this->where($where)->value($fields);
}
} }
\ No newline at end of file
...@@ -13,6 +13,8 @@ use app\api_broker\service\ClientService; ...@@ -13,6 +13,8 @@ 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\extra\RedisExt;
use app\model\AAgents;
use app\model\AAgentsPhone;
use app\model\AliYunSecretReport; use app\model\AliYunSecretReport;
use app\model\BindingPhone; use app\model\BindingPhone;
use app\model\SecretReport; use app\model\SecretReport;
...@@ -143,7 +145,8 @@ class PrivacyNumber ...@@ -143,7 +145,8 @@ class PrivacyNumber
{ {
set_time_limit(0); set_time_limit(0);
$m_bind = new BindingPhone(); $m_bind = new BindingPhone();
$m_agent = new AAgents();
$m_agent_phone = new AAgentsPhone();
$fields = 'a.id,aliYun_phone_id,expiry_date,phone_x,phone_a,phone_b,subsId,a.type,a.mappingId'; $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['a.expiry_date'] = [ '<=', date('Y-m-d') . ' 23:59:59' ]; $where['a.expiry_date'] = [ '<=', date('Y-m-d') . ' 23:59:59' ];
...@@ -154,6 +157,12 @@ class PrivacyNumber ...@@ -154,6 +157,12 @@ class PrivacyNumber
$bind = new BindingPhone(); $bind = new BindingPhone();
$redis = RedisExt::getRedis(); $redis = RedisExt::getRedis();
foreach ($bind_data['data'] as $k => $v) { foreach ($bind_data['data'] as $k => $v) {
$agent_id = $m_agent->getAgentsByWhere(['status'=>0, 'phone'=>$v['phone_a']], 'id');
if (empty($agent_id)) {
$agent_id = $m_agent_phone->getAgentsByWhere(['status'=>0, 'phone'=>$v['phone_a']], 'agents_id');
}
//解除绑定 //解除绑定
if ($v['type'] == 1 && !empty($v['subsId'])) { if ($v['type'] == 1 && !empty($v['subsId'])) {
//释放阿里云隐私号码 //释放阿里云隐私号码
...@@ -164,7 +173,7 @@ class PrivacyNumber ...@@ -164,7 +173,7 @@ class PrivacyNumber
$phone_id[$k] = $v['aliYun_phone_id']; $phone_id[$k] = $v['aliYun_phone_id'];
} }
$call_key = 'call_'.$v['phone_a'].'_'.$v['phone_b'].'_1'; $call_key = 'call_'.$agent_id.'_'.$v['phone_a'].'_'.$v['phone_b'].'_1';
$redis->del($call_key); $redis->del($call_key);
} elseif ($v['type'] == 2 && !empty($v['mappingId'])) { } elseif ($v['type'] == 2 && !empty($v['mappingId'])) {
//释放容联云隐私号码 //释放容联云隐私号码
...@@ -181,7 +190,7 @@ class PrivacyNumber ...@@ -181,7 +190,7 @@ class PrivacyNumber
} }
} }
$call_key = 'call_'.$v['phone_a'].'_'.$v['phone_b'].'_2'; $call_key = 'call_'.$agent_id.'_'.$v['phone_a'].'_'.$v['phone_b'].'_2';
$redis->del($call_key); $redis->del($call_key);
} }
} }
......
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