Commit 979ff219 authored by hujun's avatar hujun

查询重号

parent 418817b5
......@@ -745,6 +745,16 @@ class AAgents extends BaseModel
return $this->where($where)->value($fields);
}
/**
* @param $where
* @param $fields
* @return mixed
*/
public function getAgentsByWhereColumn($where, $fields)
{
return $this->where($where)->column($fields);
}
/**
* @param $where
* @param $fields
......
......@@ -73,4 +73,14 @@ class AAgentsPhone extends BaseModel
{
return $this->where($where)->value($fields);
}
/**
* @param $where
* @param $fields
* @return mixed
*/
public function getAgentsByWhereColumn($where, $fields)
{
return $this->where($where)->column($fields);
}
}
\ No newline at end of file
......@@ -145,6 +145,7 @@ class PrivacyNumber
$m_bind = new BindingPhone();
$m_agent = new AAgents();
$m_agent_phone = new AAgentsPhone();
$m_secret_report = new AliYunSecretReport();
$date = date('Y-m-d') . ' 23:59:59';
$fields = 'a.id,aliYun_phone_id,expiry_date,phone_x,phone_a,phone_b,subsId,a.type,a.mappingId';
$where['a.status'] = 1;
......@@ -164,9 +165,9 @@ class PrivacyNumber
$bind = new BindingPhone();
$redis = RedisExt::getRedis();
foreach ($bind_data['data'] as $k => $v) {
$agent_id = $m_agent->getAgentsByWhere(['status'=>0, 'phone'=>$v['phone_a']], 'id');
$agent_id = $m_agent->getAgentsByWhereColumn(['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');
$agent_id = $m_agent_phone->getAgentsByWhereColumn(['status'=>0, 'phone'=>$v['phone_a']], 'agents_id');
}
//解除绑定
......@@ -182,8 +183,10 @@ class PrivacyNumber
$phone_id[$k] = $v['aliYun_phone_id'];
}
$call_key = 'call_'.$agent_id.'_'.$v['phone_a'].'_'.$v['phone_b'].'_1';
foreach ($agent_id as $value) {
$call_key = 'call_'.$value.'_'.$v['phone_a'].'_'.$v['phone_b'].'_1';
$redis->del($call_key);
}
} elseif ($v['type'] == 2 && !empty($v['mappingId'])) {
//释放容联云隐私号码
$tong_xun = new RongDemo();
......@@ -206,10 +209,12 @@ class PrivacyNumber
}
}
$call_key = 'call_'.$agent_id.'_'.$v['phone_a'].'_'.$v['phone_b'].'_2';
foreach ($agent_id as $value) {
$call_key = 'call_'.$value.'_'.$v['phone_a'].'_'.$v['phone_b'].'_2';
$redis->del($call_key);
}
}
}
if (!empty($update)) {
$bind->updateAll($update);
......
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