Commit 07bd5637 authored by zhuwei's avatar zhuwei

权限

parent 202c4a9d
...@@ -842,7 +842,7 @@ class User extends Basic ...@@ -842,7 +842,7 @@ class User extends Basic
if(count($result) > 0){ if(count($result) > 0){
return $this->response("200", "success!", $result); return $this->response("200", "success!", $result);
}else{ }else{
return $this->response("101", "请求数据为空"); return $this->response("200", "请求数据为空");
} }
} }
......
...@@ -266,6 +266,9 @@ class UserLogService ...@@ -266,6 +266,9 @@ class UserLogService
#拨打电话按钮是否显示 0:显示 1:不显示 #拨打电话按钮是否显示 0:显示 1:不显示
$result['is_phone_button_show'] = $this->isPhoneButtonShow($user_id,$result['user_phone'],$result["agent_id"],$agent_id); $result['is_phone_button_show'] = $this->isPhoneButtonShow($user_id,$result['user_phone'],$result["agent_id"],$agent_id);
big_log('拨打电话按钮是否显示');
big_log($result['is_phone_button_show']);
big_log('拨打电话按钮是否显示');
return $result; return $result;
} }
...@@ -280,30 +283,41 @@ class UserLogService ...@@ -280,30 +283,41 @@ class UserLogService
*/ */
public function isPhoneButtonShow($user_id,$result_user_phone,$result_agent_id,$agent_id) public function isPhoneButtonShow($user_id,$result_user_phone,$result_agent_id,$agent_id)
{ {
$is_phone_button_show = 1;
#客户是否在保护期内(0:保护器内 1:超过保护期)
$user_service = new UserService(); $user_service = new UserService();
$is_outstrip_twenty_four_hours = $user_service->isUserProtect($user_id);
big_log($is_outstrip_twenty_four_hours);
#判断当天被拨打是否超过5次,同时判断是否当前经纪人跟当前客户是否有电话绑定(0允许拨打 1不允许拨打)
$is_outpace_call_num = $this->userDetailIsOutpaceCallNum($user_id,$result_user_phone, $agent_id);
big_log($is_outpace_call_num);
#查询当前经纪人是否是某个客方的总监 0:可查看 1:不可查看 #查询当前经纪人是否是某个客方的总监 0:可查看 1:不可查看
$is_can_look = $user_service->isUserAgentDirector($result_agent_id, $agent_id); $is_can_look = $user_service->isUserAgentDirector($result_agent_id, $agent_id);
big_log('查询当前经纪人是否是某个客方的总监');
big_log($is_can_look); big_log($is_can_look);
$vip_services = new VipService(); $vip_services = new VipService();
#是否有权限查看vip客户 0:可查看 1:不可查看 #是否有权限查看vip客户 0:可查看 1:不可查看
$examine_vip = $vip_services->vip($agent_id); $examine_vip = $vip_services->vip($agent_id);
big_log('是否有权限查看vip客户');
big_log($examine_vip); big_log($examine_vip);
if($is_outstrip_twenty_four_hours == 1 or $is_outpace_call_num == 0 or $is_can_look == 0 or $examine_vip == 0){ $called = $this->userDetailIsOutpaceCallNumPhone($result_user_phone, $agent_id);
$is_phone_button_show = 0;
if($is_can_look == 0 or $examine_vip == 0 or $called == 0){
return 0;//如果是客方的总监 或者 有权限查看vip客户 直接返回0
}
#客户是否在保护期内(0:保护器内 1:超过保护期)
$is_outstrip_twenty_four_hours = $user_service->isUserProtect($user_id);
big_log('客户是否在保护期内');
big_log($is_outstrip_twenty_four_hours);
#判断当天被拨打是否超过5次 (0:拨打不超过5次 1:超过5次)
$is_outpace_call_num = $this->userDetailIsOutpaceCallNum5($user_id);
big_log('判断当天被拨打是否超过5次');
big_log($is_outpace_call_num);
if($is_outstrip_twenty_four_hours == 0 or $is_outpace_call_num == 1){
return 1;//过了保护期 或者 有绑定关系 直接返回0
} }
return $is_phone_button_show;
return 1;
} }
/** /**
...@@ -351,16 +365,22 @@ class UserLogService ...@@ -351,16 +365,22 @@ class UserLogService
return $is_outpace_call_num; return $is_outpace_call_num;
}*/ }*/
public function userDetailIsOutpaceCallNum($user_id,$user_phone, $agent_id) public function userDetailIsOutpaceCallNum5($user_id)
{ {
$is_outpace_call_num = 0; $is_outpace_call_num = 0;
$clientService = new ClientService(); $clientService = new ClientService();
$m_agent_phone = new AAgentsPhone();
$redis = RedisExt::getRedis();
if (!$clientService->dialTotal($user_id)) { if (!$clientService->dialTotal($user_id)) {
$is_outpace_call_num = 1; $is_outpace_call_num = 1;
} }
return $is_outpace_call_num;//0拨打不超过5次 1超过5次
}
public function userDetailIsOutpaceCallNumPhone($user_phone, $agent_id)
{
$is_outpace_call_num = 0;
$m_agent_phone = new AAgentsPhone();
$redis = RedisExt::getRedis();
$phone = $this->agentModel->getAgentsById($agent_id, 'phone'); $phone = $this->agentModel->getAgentsById($agent_id, 'phone');
if ($is_outpace_call_num == 1 ) { if ($is_outpace_call_num == 1 ) {
...@@ -370,12 +390,12 @@ class UserLogService ...@@ -370,12 +390,12 @@ class UserLogService
} }
$call_key = 'call_'.$agent_id.'_'.$phone.'_'.$user_phone.'_'.$is_privacy; $call_key = 'call_'.$agent_id.'_'.$phone.'_'.$user_phone.'_'.$is_privacy;
$redis_res = $redis->get($call_key); $redis_res = $redis->get($call_key);
big_log($redis_res);
if(empty($redis_res)){ if(empty($redis_res)){
$is_outpace_call_num = 1; $is_outpace_call_num = 1;
} }
} }
return $is_outpace_call_num;//0允许拨打 1不允许拨打 return $is_outpace_call_num;//0有绑定关系 1无绑定关系
} }
/** /**
......
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