Commit a3bdedd2 authored by hujun's avatar hujun

删除房东跟进注释,代码调整

parent 7235d324
<?php
/**
* Created by PhpStorm.
* User: fuju
* User: hu jun
* Date: 2018/7/9
* Time: 16:28
*/
......@@ -14,7 +14,6 @@ use app\api_broker\untils\RongDemo;
use app\extra\RedisExt;
use app\model\AliYunPhone;
use app\model\BindingPhone;
use app\model\GHousesFollowUp;
use app\model\SecretReport;
use app\model\UPhoneFollowPp;
use app\model\Users;
......@@ -42,7 +41,7 @@ class CallPhoneService
public function __construct(string $city = '上海市')
{
$this->city = substr($city,0,strpos($city, '市')); //去市
$this->city = substr($city, 0, strpos($city, '市')); //去市
$this->redis = RedisExt::getRedis();
$this->is_privacy = $this->redis->get('s_is_privacy');
$this->day_num = $this->redis->get('s_day_num');
......@@ -348,7 +347,7 @@ class CallPhoneService
//尝试5次再绑定
for ($i = 0; $i < 5; $i++) {
$phone_x = $aliYunPhone->getAliYunPhoneAll($this->phone_a, $this->phone_b, $this->is_privacy, $phone_x_arr); //获取未绑定隐号
$phone_x = $aliYunPhone->getAliYunPhoneAll($this->phone_a, $this->phone_b, $this->is_privacy, $phone_x_arr, $this->city); //获取未绑定隐号
$result = $yun_tong_xun->setNumber($this->phone_a, $this->phone_b, $phone_x['data']['phone_x'], $phone_x['data']['area'], $this->expiry_date, $record);
if ($result['statusCode'] == '000000') {
......@@ -392,7 +391,8 @@ class CallPhoneService
* @param string $field
* @return array|false|\PDOStatement|string|\think\Model
*/
public function getUserData($field = 'user_phone') {
public function getUserData($field = 'user_phone')
{
$m_user = new Users();
$data = $m_user->selectUser($this->user_id, $field);
return $data;
......@@ -406,7 +406,8 @@ class CallPhoneService
* @param $status
* @return int|string
*/
public function getBindNum( $phone_b, $phone_a, $status = 1) {
public function getBindNum($phone_b, $phone_a, $status = 1)
{
$m_bind = new BindingPhone();
return $m_bind->getCallNumber($phone_a, $phone_b, $status);
}
......@@ -414,27 +415,22 @@ class CallPhoneService
/**
* 默认跟进,供定时任务使用
*/
public function defaultFollowUp() {
public function defaultFollowUp()
{
$m_follow_up = new UPhoneFollowPp();
// $m_follow_house = new GHousesFollowUp();
$current_time = time();
$time = $current_time - 3600;
$start_date = date('Y-m-d', $time);
$end_date = date('Y-m-d');
$user_key = 'call_phone_user_'.$end_date;
// $landlord_key = 'call_phone_landlord_'.$end_date;
$user_key = 'call_phone_user_' . $end_date;
$user_data = $this->redis->hKeys($user_key);
// $landlord_data = $this->redis->hKeys($landlord_key);
$content = '拨打电话,未打跟进。';
$follow_where['create_time'] = ['between', [$start_date, $end_date]];
//用户
if (!empty($user_data)) {
foreach ($user_data as $k=>$v) {
foreach ($user_data as $k => $v) {
$call_time = $this->redis->hGet($user_key, $v);
if ($current_time - $call_time > 3600) {
......@@ -451,26 +447,7 @@ class CallPhoneService
}
}
}
//房东
// if (!empty($landlord_data)) {
// foreach ($landlord_data as $k2=>$v2) {
// $call_time = $this->redis->hGet($landlord_key, $v2);
// if ($current_time - $call_time > 3600) {
// $array = explode('-', $v2);
// $follow_where['agent_id'] = $array[0];
// $follow_where['house_id'] = $array[1];
// $is = $m_follow_house->getFollowUpByHouseId($follow_where);
//
// if (!$is) {
// $m_follow_house->insertDefaultFollow($array[0], $array[1], $content, $array[3], $array[2]);
// $this->redis->hDel($landlord_key, $v2);
// }
// }
// }
// }
return ;
return;
}
/**
......@@ -482,21 +459,22 @@ class CallPhoneService
* @param $phone_b
* @param int $user_type
*/
public function recordCallRedis($agent_id, $user_id, $phone_a, $phone_b, $user_type = 1) {
public function recordCallRedis($agent_id, $user_id, $phone_a, $phone_b, $user_type = 1)
{
$date = date('Y-m-d');
if ($user_type == 1) {
$key = 'call_phone_user_'.$date;
$key = 'call_phone_user_' . $date;
} else {
$key = 'call_phone_landlord_'.$date;
$key = 'call_phone_landlord_' . $date;
}
if ($user_type == 1) {
$this->redis->hSet($key, $agent_id.'-'. $user_id, time());
$this->redis->hSet($key, $agent_id . '-' . $user_id, time());
} else {
$this->redis->hSet($key, $agent_id.'-'. $user_id . '-'. $phone_a .'-'. $phone_b, time());
$this->redis->hSet($key, $agent_id . '-' . $user_id . '-' . $phone_a . '-' . $phone_b, time());
}
return ;
return;
}
}
\ No newline at end of file
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