Commit 4fa4c17e authored by hujun's avatar hujun

房东手机号搜索

parent 520f7511
......@@ -138,6 +138,7 @@ class CallPhoneService
$this->release = 1; //是否释放
if (empty($this->day_num)) {
$this->expiry_date = _EXPIRATION;
$user_type = 0;
} else {
if ($landlord) {
if ($this->day_num == 0) {
......@@ -146,11 +147,14 @@ class CallPhoneService
} else {
$this->expiry_date = date('Y-m-d H:i:s', strtotime("+{$this->landlord_phone_day} day"));
}
$user_type = 1;
} else {
$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) {
/*阿里云*/
$call_phone = $this->aliYunBind();
......@@ -160,7 +164,7 @@ class CallPhoneService
$result['phone'] = $call_phone['phone'];
$result['msg'] = $call_phone['msg'];
$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);
} else {
$result['msg'] = $call_phone['msg'];
......@@ -173,13 +177,18 @@ class CallPhoneService
$result['phone'] = $call_phone['phone'];
$result['msg'] = $call_phone['msg'];
$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);
} else {
$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); //记录日志
} catch (\Exception $e) {
$data['status'] = 'failed';
......@@ -335,6 +344,7 @@ class CallPhoneService
}
$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 {
if ($this->is_privacy == 1) {
/*阿里云*/
......@@ -363,6 +373,7 @@ class CallPhoneService
}
$this->redis->del($call_key);
$this->redis->del($id_key);
} catch (\Exception $e) {
$data['status'] = 'failed';
$data['msg'] = $e->getMessage();
......
......@@ -86,6 +86,10 @@ class CellPhone extends Basic
$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);
$m_user = new Users();
$m_phone_follow = new UPhoneFollowPp($this->siteId);
......
......@@ -17,6 +17,7 @@ use app\model\AAgents;
use app\model\AAgentsPhone;
use app\model\AliYunSecretReport;
use app\model\BindingPhone;
use app\model\GLandlordPhone;
use app\model\TAgentTotalCallModel;
use app\model\Users;
use think\Db;
......@@ -96,18 +97,34 @@ class PrivacyNumber
$save_data = $v;
$save_data['report_id'] = $v['id'];
unset($save_data['id']); //阿里大于返回是的id改为report_id
if ($v['phone_no']) {
$agent_where['phone'] = $v['phone_no'];
$agent_where['status'] = 0;
$agent_where['password'] = ['NOT NULL'];
$agent_id = $this->m_agent->getAgentsByWhere($agent_where, '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');
$info = $this->redis->get($v['phone_no'].'_'.$v['secret_no'].'_'.$v['peer_no'].'_0');
if (empty($info)) {
if ($v['phone_no']) {
$agent_where['phone'] = $v['phone_no'];
$agent_where['status'] = 0;
$agent_where['password'] = ['NOT NULL'];
$agent_id = $this->m_agent->getAgentsByWhere($agent_where, '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;
$save_data['users_id'] = $this->m_user->getUserByWhereValue('id', ['user_phone' => $save_data['peer_no']]);
} else {
$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']);
......@@ -326,18 +343,33 @@ class PrivacyNumber
'call_type' => $call_type,
];
if ($phone_a) {
$agent_where['phone'] = $phone_a;
$agent_where['status'] = 0;
$agent_where['password'] = ['NOT NULL'];
$agent_id = $this->m_agent->getAgentsByWhere($agent_where, 'id');
if (empty($agent_id)) {
$phone_where['phone'] = $phone_a;
$phone_where['status'] = 0;
$agent_id = $this->m_agent_phone->getAgentsByWhere($phone_where, 'agents_id');
$info = $this->redis->get($phone_a.'_'.$params['servingNum'].'_'.$phone_b.'_1');
if (empty($info)) {
if ($phone_a) {
$agent_where['phone'] = $phone_a;
$agent_where['status'] = 0;
$agent_where['password'] = ['NOT NULL'];
$agent_id = $this->m_agent->getAgentsByWhere($agent_where, 'id');
if (empty($agent_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;
$data['users_id'] = $this->m_user->getUserByWhereValue('id', ['user_phone' => $phone_b]);
} else {
$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]);
......
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