Commit 2c38bc2a authored by zhuwei's avatar zhuwei

判断是否当前经纪人跟当前客户是否有电话绑定 从redis查询

parent 1fa7fc2b
......@@ -2,8 +2,10 @@
namespace app\index\controller;
use app\extra\RedisExt;
use app\index\extend\Basic;
use app\model\GBusinessDistrict;
use app\model\UPhoneFollowPp;
use think\Log;
/**
......@@ -91,7 +93,44 @@ class BatchProcessing extends Basic
}
/**
* 设置电话跟进保护期
*/
public function updatePhoneFollowUpIsShow(){
$success_num_ = 0;
$success_num = 0;
$model = new UPhoneFollowPp();
$redis = RedisExt::getRedis();
//$redis->set('set_user_save_time_1', 1, 24 * 3600);
$field = 'id,user_id';
$params = '';
$result = $model->getPhoneFollow($field, $params);
//dump($result);
foreach($result as $k=>$v)
{
$success_num_ ++;
//$is_show = 1 ;
//todo 查询redis 是否过保护期
$redis_res = $redis->get('set_user_save_time_'. $v["id"]);//找到返回'1' 找不到返回'false'
if($redis_res){
$success_num ++;
$is_show = 0 ;
//todo 更新记录
$insert=[];
$insert["id"] = $v["id"];
$insert["is_show"] = $is_show;
$res = $model->updatePhoneFollow($insert);//int(1)
}
}
return $this->response("200", "处理完成",['处理数'=>$success_num_,'修改数'=>$success_num]);
}
}
}
......@@ -10,6 +10,7 @@ namespace app\index\controller;
use app\api_broker\service\CallPhoneService;
use app\api_broker\service\ClientService;
use app\extra\RedisExt;
use app\index\extend\Basic;
use app\index\service\UserService;
use app\model\AAgents;
......@@ -119,11 +120,10 @@ class Remark extends Basic
}
$field = 'id,user_id,create_time,content,user_status,labels_id,agent_id as f_agent_id';
$data['data']['list'] = $u_phone_follow->getFollowList($pageNo, $pageSize, $order_ = 'id desc', $field, $where);
$redis = RedisExt::getRedis();
foreach ($data['data']['list'] as $k => $v) {
// dump($v);
//dump($v);
//查询客户是否在保护期内
//判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期
$user_service = new UserService();
......@@ -139,11 +139,18 @@ class Remark extends Basic
}
$model = new AAgents();
$result = $model->searchAgentsByKeyword("id,name,phone", [ "id" => $this->params["agent_id"]]);
$call = new CallPhoneService();
$result = $call->getBindNum($v['user_phone'],$result[0]['phone']);
if($result != 0){
$is_outpace_call_num = 0;
}
//$call = new CallPhoneService();
//$result = $call->getBindNum($v['user_phone'],$result[0]['phone']);
$is_privacy = $redis->get('s_is_privacy');//判断是否当前经纪人跟当前客户是否有电话绑定 从redis查询
if(!empty($is_privacy)) {
$call_key = 'call_'.$this->userId.'_'.$result[0]['phone'].'_'.$v['user_phone'].'_'.$is_privacy;
$redis_res = $redis->get($call_key);
if(!empty($redis_res)){
$is_outpace_call_num = 0;
}
}//判断是否当前经纪人跟当前客户是否有电话绑定 从redis查询
$data['data']['list'][$k]['is_outpace_call_num'] = $is_outpace_call_num;
/* 判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定 end*/
......
......@@ -366,4 +366,31 @@ class UPhoneFollowPp extends BaseModel
return $return;
}
/**
* 查询数据
* 朱伟 2018-10-22 14:36:06
*/
public function getPhoneFollow($field,$params)
{
$result = Db::table($this->table)
->field($field)
//->alias('a')
->where($params)
->select();
//dump($this->getLastSql());
return $result;
}
/**
* 更新数据
* 朱伟 2018-10-22 14:36:06
*/
public function updatePhoneFollow($params)
{
$result = $this->update($params);
//dump($this->getLastSql());
return $result;
}
}
......@@ -333,7 +333,8 @@ Route::group('index', [
'delPerformanceReport' => [ 'index/PerformanceReport/delPerformanceReport', [ 'method' => 'get | post' ] ],//删除
//批量处理控制器
'getCityLatAadLng' => [ 'index/BatchProcessing/getCityLatAadLng', [ 'method' => 'get | post' ] ],//批量设置商圈的经纬度
'getCityLatAadLng' => [ 'index/BatchProcessing/getCityLatAadLng', [ 'method' => 'get | post' ] ],//批量设置商圈的经纬度
'updatePhoneFollowUpIsShow' => [ 'index/BatchProcessing/updatePhoneFollowUpIsShow', [ 'method' => 'get | post' ] ],//批量设置商圈的经纬度
//站点相关
......
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