Commit 8c0bd727 authored by zhuwei's avatar zhuwei

获取客户修改日志

parent f7158a41
......@@ -926,6 +926,12 @@ class User extends Basic
//邀请人修改日志
$param_['type'] = 5;
$result['user_invite_history'] = $m_records->user_history($param_);
//客户姓名 修改记录
$param_['type'] = 9;
$result['user_name_history'] = $m_records->user_history($param_);
//城市标签 修改记录
$param_['type'] = 10;
$result['user_site_history'] = $m_records->user_history($param_);
if($result){
return $this->response("200", "success!", $result);
......
......@@ -42,7 +42,7 @@ class UserLogService
/**
* 客户详情
* 后台客户详情
* @param $user_id
* @param $agent_id
* @return mixed
......@@ -54,6 +54,8 @@ class UserLogService
public function userDetail($user_id, $agent_id)
{
$redis_service = new RedisCacheService();
$user_service = new UserService();
$vip_services = new VipService();
$user_arr = $redis_service->getRedisCache(1, $user_id);
......@@ -81,94 +83,31 @@ class UserLogService
} else {
$user_arr['agent_info'] = '';
}
$data['agent_path'] = AGENTHEADERIMGURL;
/*查询站点名*/
$site_model = new ASite();
$user_arr['site_name'] = [];
if ($user_arr['site_ids']) {
$site_ids_arr = explode(',', $user_arr['site_ids']);
foreach ($site_ids_arr as $site_v) {
$site_name = $redis_service->getRedisCache(5, $site_v);
if (empty($site_name)) {
$site_field = 'city';
$site_params['id'] = $site_v;
$site_model = $site_model->findByOne($site_field, $site_params);
$site_name = $site_model["city"];
}
$user_arr['site_name'][] = $site_name;
}
}
$data['agent_path'] = AGENTHEADERIMGURL;
$user_arr['user_phone'] = substr_replace($user_arr['user_phone'], '****', 3, 4);
/*查询站点名*/
#客户详情
$data['user_info'] = $user_arr;
/*修改记录部分 start*/
$records = new GOperatingRecords();
$param_['user_id'] = $user_id;
$param_['type'] = 3;
$records_result = $records->user_history($param_);
#获取客户修改日志
$data["user_history_log"] = $this->userHistoryLog($user_id);
$user_arr['user_phone'] = substr_replace($user_arr['user_phone'], '****', 3, 4);
$data['user_info'] = $user_arr;
$data['user_history'] = $records_result;
$param_['type'] = 5;
$records_invite_result = $records->user_history($param_);
$data['user_invite_history'] = $records_invite_result;
/*修改记录部分 end*/
/*是否被收藏 start*/
$data["is_collect"] = 2;
//先判断是否已经存在数据
$field = 'id,status';
$get_params['agents_id'] = $agent_id;
$get_params['user_id'] = $user_id;
$collect_house = new ACollectUser();
$res = $collect_house->getCollectUser($field, $get_params);
if ($res && ($res[0]['status'] == 1)) {//如果存在
$data["is_collect"] = 1;
}
/*是否被收藏 end*/
#是否被收藏
$data["is_collect"] =$this->userDetailIsCollect($user_id, $agent_id);
#保护期(0:保护器内 1:超过保护期)
$user_service = new UserService();
$data['is_outstrip_twenty_four_hours'] = $user_service->isUserProtect($user_id);
// 判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定
//0允许拨打 1不允许拨打
$data['is_outpace_call_num'] = 0;
$clientService = new ClientService();
if (!$clientService->dialTotal($user_id)) {
$data['is_outpace_call_num'] = 1;
}
// $model = new AAgents();
// $result = $model->searchAgentsByKeyword("id,name,phone", ["id" => $agent_id]);
// $call = new CallPhoneService();
// $result = $call->getBindNum($user_arr['user_phone'], $result[0]['phone']);
// if ($result != 0) {
// $data['is_outpace_call_num'] = 0;
// }
$call = new CallPhoneService();
$agent_data = $redis_service->getRedisCache(2, $agent_id);
$result = $call->checkBindRedis($agent_id, $agent_data['phone_list'], $user_arr['user_phone']);
if($result != ''){
$data['is_outpace_call_num'] = 0;
}
//查询当前经纪人是否是某个客方的总监 0:可查看 1:不可查看
$data['is_can_look'] = $user_service->isUserAgentDirector($user_arr["agent_id"], $agent_id);
$vip_services = new VipService();
//是否可以查看vip客户 0:可查看 1:不可查看
$data['examine_vip'] = $vip_services->vip($agent_id);
//绑定关系(关联客户)
$data['user_bind_list'] = $user_service->userBindInfo($user_id);
/**
* 以下是新方法,上面的找时间替换掉
*/
#根据站点id组装站点名字
$data['site_ids_name'] = $user_service->userSiteName($user_arr["site_ids"]);
#拨打电话按钮是否显示 0:显示 1:不显示
$data['is_phone_button_show'] = $this->isPhoneButtonShow($user_id,$user_arr['user_phone'],$user_arr["agent_id"],$agent_id,$user_arr['vip']);
......@@ -180,6 +119,28 @@ class UserLogService
return ["code" => 200, "data" => $data];
}
/**获取客户修改日志
* @param $user_id
* @return mixed
*/
public function userHistoryLog($user_id){
$m_records = new GOperatingRecords();
//客方修改日志
$param_['user_id'] = $user_id;
$param_['type'] = 3;
$result['user_history'] = $m_records->user_history($param_);
//邀请人修改日志
$param_['type'] = 5;
$result['user_invite_history'] = $m_records->user_history($param_);
//客户姓名 修改记录
$param_['type'] = 9;
$result['user_name_history'] = $m_records->user_history($param_);
//城市标签 修改记录
$param_['type'] = 10;
$result['user_site_history'] = $m_records->user_history($param_);
return $result;
}
/**
* 客户动态
......@@ -260,7 +221,7 @@ class UserLogService
/**
* 客户详情简略信息
* app客户详情 简略信息
* @param $user_id
* @param $agent_id
* @return mixed
......@@ -430,7 +391,7 @@ class UserLogService
}
/**
* 客户详情简略信息
* app客户详情 2
* @param $user_id
* @return mixed
*/
......
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