Commit 78abe69f authored by zhuwei's avatar zhuwei

1

parent 73b6e1e3
...@@ -206,15 +206,13 @@ class UserAgentService ...@@ -206,15 +206,13 @@ class UserAgentService
/** /**
* 查客方 * 查客方
* @param $site_id
* @param $user_id * @param $user_id
* @return array|false|\PDOStatement|string|\think\Model * @return array|false|\PDOStatement|string|\think\Model
*/ */
public function getUserAgentId($site_id,$user_id) public function getUserAgentId($user_id)
{ {
$params['site_id'] = $site_id; $params['a.user_id'] = $user_id;
$params['user_id'] = $user_id; $field = 'a.agent_id,b.phone';
$field = 'agent_id';
$user_agent_info = $this->m_user_agent->getUserAgentId($field,$params); $user_agent_info = $this->m_user_agent->getUserAgentId($field,$params);
return $user_agent_info; return $user_agent_info;
} }
......
...@@ -116,9 +116,7 @@ class UserLogService ...@@ -116,9 +116,7 @@ class UserLogService
$data['site_ids_name_new'] = $s_user_site->getSiteNameList($user_id); $data['site_ids_name_new'] = $s_user_site->getSiteNameList($user_id);
#拨打电话按钮是否显示 0:显示 1:不显示 #拨打电话按钮是否显示 0:显示 1:不显示
$s_user_agent = new UserAgentService(); $data['is_phone_button_show'] = $this->isPhoneButtonShow($user_id,$agent_id,$user_arr['vip']);
$user_agent_id = $s_user_agent->getUserAgentId($site_id,$user_id);
$data['is_phone_button_show'] = $this->isPhoneButtonShow($user_id,$user_arr['user_phone'],$user_agent_id['agent_id'],$agent_id,$user_arr['vip']);
//客方 //客方
$s_user_agent = new UserAgentService(); $s_user_agent = new UserAgentService();
...@@ -268,9 +266,7 @@ class UserLogService ...@@ -268,9 +266,7 @@ class UserLogService
$result["is_outstrip_twenty_four_hours"] = $user_service->isUserProtect($user_id); $result["is_outstrip_twenty_four_hours"] = $user_service->isUserProtect($user_id);
#拨打电话按钮是否显示 0:显示 1:不显示 #拨打电话按钮是否显示 0:显示 1:不显示
$s_user_agent = new UserAgentService(); $result['is_phone_button_show'] = $this->isPhoneButtonShow($user_id, $agent_id,$result['vip']);
$user_agent_id = $s_user_agent->getUserAgentId($site_id,$user_id);
$result['is_phone_button_show'] = $this->isPhoneButtonShow($user_id,$result['user_phone'],$user_agent_id["agent_id"],$agent_id,$result['vip']);
#编辑客户详情权限 0:有权限 1:无权限 #编辑客户详情权限 0:有权限 1:无权限
...@@ -333,25 +329,38 @@ class UserLogService ...@@ -333,25 +329,38 @@ class UserLogService
/** /**
* 拨打电话按钮是否显示 * 拨打电话按钮是否显示
* @param $user_id * @param $user_id
* @param $result_user_phone
* @param $result_agent_id
* @param $agent_id * @param $agent_id
* @param $is_vip
* @return int * @return int
*/ */
public function isPhoneButtonShow($user_id,$result_user_phone,$result_agent_id,$agent_id,$is_vip) public function isPhoneButtonShow($user_id,$agent_id,$is_vip)
{ {
$user_service = new UserService(); $user_service = new UserService();
$vip_services = new VipService(); $vip_services = new VipService();
$s_user_agent = new UserAgentService();
$user_agent_list = $s_user_agent->getUserAgentId($user_id);
$is_user_agent_boss = 1;
$called = 1;
$user_agent_list_arr=[];
if($user_agent_list){
foreach ($user_agent_list as $key => $value) {
$user_agent_list_arr[] = $value['agent_id'];
#查询当前经纪人是否是某个客方的总监 0:可查看 1:不可查看 #查询当前经纪人是否是某个客方的总监 0:可查看 1:不可查看
$is_user_agent_boss = $user_service->isUserAgentDirector($result_agent_id, $agent_id); $agent_boss_res = $user_service->isUserAgentDirector($value['agent_id'], $agent_id);
if($agent_boss_res == 0)
$is_user_agent_boss = 0;
#是否有绑定关系 0有 1无
$called_res = $this->userDetailIsOutpaceCallNumPhone($value['phone'], $agent_id);
if($called_res == 0)
$called = 0;
}
}
#判断当天被拨打是否超过5次 (0:拨打不超过5次 1:超过5次) #判断当天被拨打是否超过5次 (0:拨打不超过5次 1:超过5次)
$is_outpace_call_num = $this->userDetailIsOutpaceCallNum5($user_id); $is_outpace_call_num = $this->userDetailIsOutpaceCallNum5($user_id);
#是否有绑定关系 0有 1无
$called = $this->userDetailIsOutpaceCallNumPhone($result_user_phone, $agent_id);
#客户是否在保护期内(0:保护器内 1:超过保护期) #客户是否在保护期内(0:保护器内 1:超过保护期)
$is_outstrip_twenty_four_hours = $user_service->isUserProtect($user_id); $is_outstrip_twenty_four_hours = $user_service->isUserProtect($user_id);
...@@ -367,13 +376,13 @@ class UserLogService ...@@ -367,13 +376,13 @@ class UserLogService
OR OR
($is_user_agent_boss == 0)//总监可以看 ($is_user_agent_boss == 0)//总监可以看
OR OR
($result_agent_id == $agent_id)//客方可以看 in_array($agent_id, $user_agent_list_arr)//客方可以看
OR OR
(($is_vip == 1) and ($examine_vip == 0)) (($is_vip == 1) and ($examine_vip == 0))
OR OR
(($is_outpace_call_num == 0 ) and ($is_outstrip_twenty_four_hours == 0) and (($is_user_agent_boss == 0) or ($result_agent_id == $agent_id) or ($called == 0))) (($is_outpace_call_num == 0 ) and ($is_outstrip_twenty_four_hours == 0) and (($is_user_agent_boss == 0) or (in_array($agent_id, $user_agent_list_arr)) or ($called == 0)))
OR OR
(($is_outpace_call_num == 1 ) and (($is_user_agent_boss == 0) or ($result_agent_id == $agent_id) or ($called == 0))) (($is_outpace_call_num == 1 ) and (($is_user_agent_boss == 0) or (in_array($agent_id, $user_agent_list_arr)) or ($called == 0)))
OR OR
($is_report == 0) ($is_report == 0)
){ ){
......
...@@ -124,7 +124,7 @@ class UserService ...@@ -124,7 +124,7 @@ class UserService
$user_agent_res = $s_user_agent->findUserAgent($site_id,0,$id); $user_agent_res = $s_user_agent->findUserAgent($site_id,0,$id);
if (!$user_agent_res) { if (!$user_agent_res) {
$s_user_agent->addUserAgent($data['agents_id'],$id,$site_id); $s_user_agent->addUserAgent($data['agents_id'],$id,$site_id);
//记录修改客方 //记录新增客方
$this->recordGuest($data['agents_id'], $agent_id_old, $id, $user_name, $type); $this->recordGuest($data['agents_id'], $agent_id_old, $id, $user_name, $type);
}else{ }else{
if (!empty($data['agents_id']) && ($data['agents_id'] != $agent_id_old)) { if (!empty($data['agents_id']) && ($data['agents_id'] != $agent_id_old)) {
......
...@@ -53,8 +53,10 @@ class UserAgentModel extends Model ...@@ -53,8 +53,10 @@ class UserAgentModel extends Model
$params["is_del"] = 0; $params["is_del"] = 0;
$result = $this->db_ $result = $this->db_
->field($field) ->field($field)
->alias('a')
->join('a_agents b', 'a.agent_id = b.id', 'left')
->where($params) ->where($params)
->find(); ->select();
//echo $this->getLastSql(); //echo $this->getLastSql();
return $result; return $result;
} }
......
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