Commit 2f24b0ca authored by hujun's avatar hujun

拨打电话默认跟进

parent 7c841873
......@@ -17,6 +17,7 @@ use app\api_broker\service\BrokerService;
use app\api_broker\service\CallPhoneService;
use app\api_broker\service\ClientService;
use app\api_broker\service\OrderLogService;
use app\extra\RedisExt;
use app\model\AAgents;
use app\model\ABindingDevice;
use app\model\ACollectUser;
......@@ -305,6 +306,11 @@ class Broker extends Basic
if ($result > 0) {
//跟进,对客户状态进行更新 0:求租;1:已租;-1:无效
$Users->update_user_status([ 'id' => $user_id, 'user_status' => $user_status ]);
$redis = RedisExt::getRedis();
$user_key = 'call_phone_user_'.date('Y-m-d');
$hash_key = $this->agentId.'-'.$params['user_id'];
$redis->hDel($user_key, $hash_key);
return $this->response("200", "success!", $result);
} else {
return $this->response("101", "失败!");
......
......@@ -424,17 +424,17 @@ class CallPhoneService
*/
public function defaultFollowUp() {
$m_follow_up = new UPhoneFollowPp();
$m_follow_house = new GHousesFollowUp();
// $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;
// $landlord_key = 'call_phone_landlord_'.$end_date;
$user_data = $this->redis->hKeys($user_key);
$landlord_data = $this->redis->hKeys($landlord_key);
// $landlord_data = $this->redis->hKeys($landlord_key);
$content = '拨打电话,未打跟进。';
$follow_where['create_time'] = ['between', [$start_date, $end_date]];
......@@ -460,22 +460,22 @@ 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);
}
}
}
}
// 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 ;
}
......@@ -485,7 +485,9 @@ class CallPhoneService
*
* @param $agent_id
* @param $user_id
* @param $user_type
* @param $phone_a
* @param $phone_b
* @param int $user_type
*/
public function recordCallRedis($agent_id, $user_id, $phone_a, $phone_b, $user_type = 1) {
$date = date('Y-m-d');
......@@ -496,7 +498,12 @@ class CallPhoneService
$key = 'call_phone_landlord_'.$date;
}
$this->redis->hSet($key, $agent_id.'-'. $user_id . '-'. $phone_a .'-'. $phone_b, time());
if ($user_type == 1) {
$this->redis->hSet($key, $agent_id.'-'. $user_id, time());
} else {
$this->redis->hSet($key, $agent_id.'-'. $user_id . '-'. $phone_a .'-'. $phone_b, time());
}
return ;
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
namespace app\index\controller;
use app\api_broker\service\CallPhoneService;
use app\api_broker\service\ClientService;
use app\api_broker\service\UserExpiredTimeService;
use app\extra\RedisExt;
use app\index\extend\Basic;
use app\index\service\UserService;
use app\model\AAgents;
......@@ -11,7 +11,6 @@ use app\model\ACollectUser;
use app\model\GOperatingRecords;
use app\model\Users;
use app\model\UPhoneFollowPp;
use app\task\controller\ResultsSummaryNewTask;
use think\Request;
use think\session;
......@@ -378,6 +377,11 @@ class Member extends Basic{
$table->allowField(true)->save($params);
$user = new Users();
$user->update_user_status(['id'=>$params['user_id'],'user_status'=>$params['user_status']]);
$redis = RedisExt::getRedis();
$user_key = 'call_phone_user_'.date('Y-m-d');
$hash_key = $this->userId.'-'.$params['user_id'];
$redis->hDel($user_key, $hash_key);
return $this->response($status, $msg, $params);
}
......
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