Commit ac90399f authored by zhuwei's avatar zhuwei

1

parent 5f978dc3
...@@ -390,6 +390,7 @@ class Broker extends Basic ...@@ -390,6 +390,7 @@ class Broker extends Basic
*/ */
public function appraiserV2() public function appraiserV2()
{ {
header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
$data['status'] = 101; $data['status'] = 101;
$data['data'] = []; $data['data'] = [];
......
...@@ -53,6 +53,7 @@ class Performance extends Basic ...@@ -53,6 +53,7 @@ class Performance extends Basic
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time()); $start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time());
$list = $this->service_->totalAgent($params["agent_id"], $params["type"], $start_day, $end_day, $params["site_id"]); $list = $this->service_->totalAgent($params["agent_id"], $params["type"], $start_day, $end_day, $params["site_id"]);
$company_list = $this->service_->companyTotalAgent($params["agent_id"], $params["type"], $start_day, $end_day);
$all_performance_total = $all_official_receipts_total = 0; $all_performance_total = $all_official_receipts_total = 0;
foreach ($list as $key => $value) { foreach ($list as $key => $value) {
$all_performance_total += $value['performance_total']; $all_performance_total += $value['performance_total'];
...@@ -70,6 +71,9 @@ class Performance extends Basic ...@@ -70,6 +71,9 @@ class Performance extends Basic
} }
$result["all_performance_total"] = $all_performance_total; $result["all_performance_total"] = $all_performance_total;
$result["all_official_receipts_total"] = $all_official_receipts_total; $result["all_official_receipts_total"] = $all_official_receipts_total;
$result["company_performance_total"] = $company_list['company_performance_total'];
$result["company_official_receipts_total"] = $company_list['company_official_receipts_total'];
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} }
return $this->response("200", "request null"); return $this->response("200", "request null");
......
...@@ -137,6 +137,35 @@ class PerformanceService ...@@ -137,6 +137,35 @@ class PerformanceService
} }
public function companyTotalAgent($agent_id, $type, $yesterday, $end_day)
{
$params["agent_id"] = $agent_id;
$agent_info = $this->agentModel->getAgentById("id,store_id,district_id,level", $params);
if (count($agent_info) > 0) {
$agent_info = $agent_info[0];
}
$where_ = [];
// $where_['d.site_id'] = $site_id;
$where_['a.total_time'] = array( 'between', array( $yesterday, $end_day ) );
$field = " a.agent_id,
a.store_id,
a.district_id,
sum(a.performance) as performance_total,
sum(a.official_receipts) as official_receipts_total
";
$order = "performance_total desc";
$result = $this->totalModel->getTotalByAgentIdSite($field, $where_, $type, $order);
$company_performance_total = $company_official_receipts_total = 0;
foreach ($result as $key => $value) {
$company_performance_total += $value['performance_total'];
$company_official_receipts_total += $value['official_receipts_total'];
}
$result_['company_performance_total'] = $company_performance_total;
$result_['company_official_receipts_total'] = $company_official_receipts_total;
return $result_;
}
/** /**
* 个人业绩 * 个人业绩
......
...@@ -182,7 +182,7 @@ class ImageDepot extends Basic ...@@ -182,7 +182,7 @@ class ImageDepot extends Basic
$m = new UserCallStintService(); $m = new UserCallStintService();
$user_id = 87;//135558 135562 87 $user_id = 87;//135558 135562 87
// $res = $m->getUserBindList($user_id); // $res = $m->getUserBindList($user_id);
$res = $m->isReport($user_id); $res = $m->getUserReportAgentIdList($user_id);
dump($res); dump($res);
} }
......
...@@ -23,6 +23,69 @@ class UserCallStintService ...@@ -23,6 +23,69 @@ class UserCallStintService
$this->m_report = new OReportModel(); $this->m_report = new OReportModel();
} }
/**
* 主方法
* 客户当天是否有约带看
* 显示客户'约带看中'状态
* 包括关联的客户
* 0:不显示 1:显示
* @param $user_id
* @return int
*/
public function isUserReport($user_id){
$is_report = 0;
$band_user_list = $this->getUserBindList($user_id);
foreach ($band_user_list as $v) {
$res = $this->findReport($v);
if($res){
$is_report = 1;
break;
}
}
return $is_report;
}
/**
* 主方法
* 客户当天是否有约带看的经纪人id列表
* @param $user_id
* @return array
*/
public function getUserReportAgentIdList($user_id){
$agent_ids = [];
$band_user_list = $this->getUserBindList($user_id);
foreach ($band_user_list as $v) {
$res = $this->findReportAgentIdList($v);
if($res){
foreach ($res as $v1) {
$agent_ids[] = $v1['report_agent_id'];
}
}
}
return $agent_ids;
}
/** /**
* 根据客户id查询有绑定关系的所有客户 * 根据客户id查询有绑定关系的所有客户
* @param $user_id * @param $user_id
...@@ -75,22 +138,23 @@ class UserCallStintService ...@@ -75,22 +138,23 @@ class UserCallStintService
/** /**
* 客户当天是否有约带看 包括关联的客户 * 经纪人id
* @param $user_id * @param $user_id
* @return bool * @return false|\PDOStatement|string|\think\Collection
*/ */
public function isUserReport($user_id){ public function findReportAgentIdList($user_id){
$is_report = false; $begin_date = date("Y-m-d 00:00:00");
$band_user_list = $this->getUserBindList($user_id); $end_date = date("Y-m-d 23:23:23");
foreach ($band_user_list as $v) {
$res = $this->findReport($v); // $conditions['report_agent_id'] = $agent_id;
if($res){ $conditions['user_id'] = $user_id;
$is_report = true; $conditions['predict_see_time'] = array( 'between', array( $begin_date, $end_date));
break; $report = $this->m_report->selectReportByIdTime('report_agent_id',$conditions);
} return $report;
}
return $is_report;
} }
} }
\ No newline at end of file
...@@ -269,13 +269,20 @@ class UserLogService ...@@ -269,13 +269,20 @@ class UserLogService
$user_service = new UserService(); $user_service = new UserService();
$result["is_outstrip_twenty_four_hours"] = $user_service->isUserProtect($user_id); $result["is_outstrip_twenty_four_hours"] = $user_service->isUserProtect($user_id);
#有约带看的客户显示 '约带看'标签 0:不显示 1:显示
$s_user_call = new UserCallStintService();
$is_user_report = $s_user_call->isUserReport($user_id);
$result['is_user_report'] = $is_user_report;
#拨打电话按钮是否显示 0:显示 1:不显示 #拨打电话按钮是否显示 0:显示 1:不显示
$result['is_phone_button_show'] = $this->isPhoneButtonShow($user_id, $agent_id,$result['vip'],$result['user_phone'],$result['agent_id']); $result['is_phone_button_show'] = $this->isPhoneButtonShow($user_id, $agent_id, $result['vip'], $result['user_phone'], $result['agent_id']);
#编辑客户详情权限 0:有权限 1:无权限 #编辑客户详情权限 0:有权限 1:无权限
$result['is_can_edit_user_info'] = $user_service->isCanEditUserInfo($result["agent_id"], $agent_id,$user_id); $result['is_can_edit_user_info'] = $user_service->isCanEditUserInfo($result["agent_id"], $agent_id,$user_id);
// $this->agentLookUser($user_id, $agent_id, 0); //记录经纪人看客户 //$this->agentLookUser($user_id, $agent_id, 0); //记录经纪人看客户
return $result; return $result;
} }
...@@ -385,6 +392,24 @@ class UserLogService ...@@ -385,6 +392,24 @@ class UserLogService
#经纪人客户是否有约带看 0:可查看 1:不可查看 #经纪人客户是否有约带看 0:可查看 1:不可查看
$is_report = $user_service->isReport($agent_id,$user_id); $is_report = $user_service->isReport($agent_id,$user_id);
#当天有约带看的客户 0:不显示 1:显示
$s_user_call = new UserCallStintService();
$is_user_report = $s_user_call->isUserReport($user_id);
//3.3.9 如果有约带看 同时过保护期了
if($is_user_report == 1 and ($is_outstrip_twenty_four_hours == 1)){
$s_user_call = new UserCallStintService();
$report_agents = $s_user_call->getUserReportAgentIdList($user_id);
//3.3.9 有约带看订单的客户 预计到场当天 只能 约带看提交人 或 客方 拨打电话
if(($result_agent_id == $agent_id) or (in_array($agent_id,$report_agents))){
return 0;
}else{
return 1;
}
}
#当天有约带看的客户 0:不显示 1:显示
$result_val = 1;
if( if(
(($is_outpace_call_num == 0 ) and ($is_outstrip_twenty_four_hours == 1) and ($is_vip != 1) ) //过保护期 (($is_outpace_call_num == 0 ) and ($is_outstrip_twenty_four_hours == 1) and ($is_vip != 1) ) //过保护期
OR OR
...@@ -403,9 +428,8 @@ class UserLogService ...@@ -403,9 +428,8 @@ class UserLogService
($is_report == 0) ($is_report == 0)
){ ){
return 0;//0:显示 return 0;//0:显示
}else{
return 1;//1:不显示
} }
return $result_val;
} }
/** /**
......
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