Commit 4fa4c17e authored by hujun's avatar hujun

房东手机号搜索

parent 520f7511
...@@ -138,6 +138,7 @@ class CallPhoneService ...@@ -138,6 +138,7 @@ class CallPhoneService
$this->release = 1; //是否释放 $this->release = 1; //是否释放
if (empty($this->day_num)) { if (empty($this->day_num)) {
$this->expiry_date = _EXPIRATION; $this->expiry_date = _EXPIRATION;
$user_type = 0;
} else { } else {
if ($landlord) { if ($landlord) {
if ($this->day_num == 0) { if ($this->day_num == 0) {
...@@ -146,11 +147,14 @@ class CallPhoneService ...@@ -146,11 +147,14 @@ class CallPhoneService
} else { } else {
$this->expiry_date = date('Y-m-d H:i:s', strtotime("+{$this->landlord_phone_day} day")); $this->expiry_date = date('Y-m-d H:i:s', strtotime("+{$this->landlord_phone_day} day"));
} }
$user_type = 1;
} else { } else {
$this->expiry_date = date('Y-m-d H:i:s', strtotime("+{$this->day_num} day")); $this->expiry_date = date('Y-m-d H:i:s', strtotime("+{$this->day_num} day"));
$user_type = 0;
} }
} }
$time_out = strtotime($this->expiry_date) - time();
if ($this->is_privacy == 1) { if ($this->is_privacy == 1) {
/*阿里云*/ /*阿里云*/
$call_phone = $this->aliYunBind(); $call_phone = $this->aliYunBind();
...@@ -160,7 +164,7 @@ class CallPhoneService ...@@ -160,7 +164,7 @@ class CallPhoneService
$result['phone'] = $call_phone['phone']; $result['phone'] = $call_phone['phone'];
$result['msg'] = $call_phone['msg']; $result['msg'] = $call_phone['msg'];
$type = 'AliYunBindAxb'; $type = 'AliYunBindAxb';
$this->redis->set($call_key, $call_phone['phone'], strtotime($this->expiry_date) - time()); $this->redis->set($call_key, $call_phone['phone'], $time_out);
$this->m_bind->recordBindPhone($call_phone['phone'], $phone_a, $phone_b, $record, $this->expiry_date, $this->subs_id, $this->request_id, $this->mapping_id, $this->is_privacy, $this->release); $this->m_bind->recordBindPhone($call_phone['phone'], $phone_a, $phone_b, $record, $this->expiry_date, $this->subs_id, $this->request_id, $this->mapping_id, $this->is_privacy, $this->release);
} else { } else {
$result['msg'] = $call_phone['msg']; $result['msg'] = $call_phone['msg'];
...@@ -173,13 +177,18 @@ class CallPhoneService ...@@ -173,13 +177,18 @@ class CallPhoneService
$result['phone'] = $call_phone['phone']; $result['phone'] = $call_phone['phone'];
$result['msg'] = $call_phone['msg']; $result['msg'] = $call_phone['msg'];
$type = 'YunTongXunBindAxb'; $type = 'YunTongXunBindAxb';
$this->redis->set($call_key, $call_phone['phone'], strtotime($this->expiry_date) - time()); $this->redis->set($call_key, $call_phone['phone'], $time_out);
$this->m_bind->recordBindPhone($call_phone['phone'], $phone_a, $phone_b, $record, $this->expiry_date, $this->subs_id, $this->request_id, $this->mapping_id, $this->is_privacy, $this->release); $this->m_bind->recordBindPhone($call_phone['phone'], $phone_a, $phone_b, $record, $this->expiry_date, $this->subs_id, $this->request_id, $this->mapping_id, $this->is_privacy, $this->release);
} else { } else {
$result['msg'] = $call_phone['msg']; $result['msg'] = $call_phone['msg'];
} }
} }
if (!empty($call_phone['phone'])) {
$call_key = $this->phone_a.'-'.$call_phone['phone'].'_'.$this->phone_b.'_'.$this->is_privacy;
$this->redis->set($call_key, $agent_id.'_'.$user_id.'_'.$user_type, $time_out);
}
Log::write(json_encode($result), $type); //记录日志 Log::write(json_encode($result), $type); //记录日志
} catch (\Exception $e) { } catch (\Exception $e) {
$data['status'] = 'failed'; $data['status'] = 'failed';
...@@ -335,6 +344,7 @@ class CallPhoneService ...@@ -335,6 +344,7 @@ class CallPhoneService
} }
$call_key = 'call_'.$agent_id.'_'.$this->phone_a.'_'.$this->phone_b.'_'.$this->is_privacy; $call_key = 'call_'.$agent_id.'_'.$this->phone_a.'_'.$this->phone_b.'_'.$this->is_privacy;
$id_key = $this->phone_a.'_'.$this->phone_x.'_'.$this->phone_b.'_'.$this->is_privacy;
try { try {
if ($this->is_privacy == 1) { if ($this->is_privacy == 1) {
/*阿里云*/ /*阿里云*/
...@@ -363,6 +373,7 @@ class CallPhoneService ...@@ -363,6 +373,7 @@ class CallPhoneService
} }
$this->redis->del($call_key); $this->redis->del($call_key);
$this->redis->del($id_key);
} catch (\Exception $e) { } catch (\Exception $e) {
$data['status'] = 'failed'; $data['status'] = 'failed';
$data['msg'] = $e->getMessage(); $data['msg'] = $e->getMessage();
......
...@@ -86,6 +86,10 @@ class CellPhone extends Basic ...@@ -86,6 +86,10 @@ class CellPhone extends Basic
$where['a.secret_no'] = trim($this->params['ali_yun_phone']); $where['a.secret_no'] = trim($this->params['ali_yun_phone']);
} }
if (!empty($this->params['user_type'])) {
$where['user_type'] = $this->params['a.user_type'];
}
$list = $report->getCallList($pageNo, $pageSize, 'id desc', $field, $where); $list = $report->getCallList($pageNo, $pageSize, 'id desc', $field, $where);
$m_user = new Users(); $m_user = new Users();
$m_phone_follow = new UPhoneFollowPp($this->siteId); $m_phone_follow = new UPhoneFollowPp($this->siteId);
......
...@@ -17,6 +17,7 @@ use app\model\AAgents; ...@@ -17,6 +17,7 @@ use app\model\AAgents;
use app\model\AAgentsPhone; use app\model\AAgentsPhone;
use app\model\AliYunSecretReport; use app\model\AliYunSecretReport;
use app\model\BindingPhone; use app\model\BindingPhone;
use app\model\GLandlordPhone;
use app\model\TAgentTotalCallModel; use app\model\TAgentTotalCallModel;
use app\model\Users; use app\model\Users;
use think\Db; use think\Db;
...@@ -96,18 +97,34 @@ class PrivacyNumber ...@@ -96,18 +97,34 @@ class PrivacyNumber
$save_data = $v; $save_data = $v;
$save_data['report_id'] = $v['id']; $save_data['report_id'] = $v['id'];
unset($save_data['id']); //阿里大于返回是的id改为report_id unset($save_data['id']); //阿里大于返回是的id改为report_id
if ($v['phone_no']) {
$agent_where['phone'] = $v['phone_no']; $info = $this->redis->get($v['phone_no'].'_'.$v['secret_no'].'_'.$v['peer_no'].'_0');
$agent_where['status'] = 0; if (empty($info)) {
$agent_where['password'] = ['NOT NULL']; if ($v['phone_no']) {
$agent_id = $this->m_agent->getAgentsByWhere($agent_where, 'id'); $agent_where['phone'] = $v['phone_no'];
if (empty($agent_id)) { $agent_where['status'] = 0;
$phone_where['phone'] = $v['phone_no']; $agent_where['password'] = ['NOT NULL'];
$phone_where['status'] = 0; $agent_id = $this->m_agent->getAgentsByWhere($agent_where, 'id');
$agent_id = $this->m_agent_phone->getAgentsByWhere($phone_where, 'agents_id'); if (empty($agent_id)) {
$phone_where['phone'] = $v['phone_no'];
$phone_where['status'] = 0;
$agent_id = $this->m_agent_phone->getAgentsByWhere($phone_where, 'agents_id');
}
$save_data['agents_id'] = $agent_id;
$save_data['users_id'] = $this->m_user->getUserByWhereValue('id', ['user_phone' => $save_data['peer_no']]);
$save_data['user_type'] = 0;
if (empty($save_data['users_id'])) {
$m_landlord = new GLandlordPhone();
$user_id = $m_landlord->getInfo('id', ['phone'=>$save_data['peer_no']]);
$save_data['users_id'] = $user_id;
$save_data['user_type'] = 1;
}
} }
$save_data['agents_id'] = $agent_id; } else {
$save_data['users_id'] = $this->m_user->getUserByWhereValue('id', ['user_phone' => $save_data['peer_no']]); $id = explode('_', $info);
$save_data['agents_id'] = $id[0];
$save_data['users_i'] = $id[1];
$save_data['user_type'] = $id[2];
} }
$call_time = strtotime($save_data['release_time']) - strtotime($save_data['start_time']); $call_time = strtotime($save_data['release_time']) - strtotime($save_data['start_time']);
...@@ -326,18 +343,33 @@ class PrivacyNumber ...@@ -326,18 +343,33 @@ class PrivacyNumber
'call_type' => $call_type, 'call_type' => $call_type,
]; ];
if ($phone_a) { $info = $this->redis->get($phone_a.'_'.$params['servingNum'].'_'.$phone_b.'_1');
$agent_where['phone'] = $phone_a; if (empty($info)) {
$agent_where['status'] = 0; if ($phone_a) {
$agent_where['password'] = ['NOT NULL']; $agent_where['phone'] = $phone_a;
$agent_id = $this->m_agent->getAgentsByWhere($agent_where, 'id'); $agent_where['status'] = 0;
if (empty($agent_id)) { $agent_where['password'] = ['NOT NULL'];
$phone_where['phone'] = $phone_a; $agent_id = $this->m_agent->getAgentsByWhere($agent_where, 'id');
$phone_where['status'] = 0; if (empty($agent_id)) {
$agent_id = $this->m_agent_phone->getAgentsByWhere($phone_where, 'agents_id'); $phone_where['phone'] = $phone_a;
$phone_where['status'] = 0;
$agent_id = $this->m_agent_phone->getAgentsByWhere($phone_where, 'agents_id');
}
$data['agents_id'] = $agent_id;
$data['users_id'] = $this->m_user->getUserByWhereValue('id', ['user_phone' => $phone_b]);
$data['user_type'] = 0;
if (empty($data['users_id'])) {
$m_landlord = new GLandlordPhone();
$user_id = $m_landlord->getInfo('id', ['phone'=>$phone_b]);
$data['users_id'] = $user_id;
$data['user_type'] = 1;
}
} }
$data['agents_id'] = $agent_id; } else {
$data['users_id'] = $this->m_user->getUserByWhereValue('id', ['user_phone' => $phone_b]); $id = explode('_', $info);
$data['agents_id'] = $id[0];
$data['users_id'] = $id[1];
$data['user_type'] = $id[2];
} }
$this->m_secret_report->insertDataAll([0=>$data]); $this->m_secret_report->insertDataAll([0=>$data]);
......
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