Commit c3fe7cb8 authored by zhuwei's avatar zhuwei

bug,代码优化

parent a6e4648f
......@@ -63,11 +63,11 @@ class Performance extends Basic
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
// $params = array(
// "type" => 3, //1表示个人业绩排行 2门店 3区域
//// "end_day" => "",
//// "start_day" =>"",
// );
/*$params = array(
"type" => 3, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>"",
);*/
$params["type"] = 3;
......@@ -104,10 +104,10 @@ class Performance extends Basic
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
// $params = array(
// "start_day" => '2018-08-08',
// "end_day" => '2018-08-08',
// );
/*$params = array(
"start_day" => '2018-08-08',
"end_day" => '2018-08-08',
);*/
$params["type"] = 2;
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
......@@ -139,11 +139,11 @@ class Performance extends Basic
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
// $params = array(
// "type" => 1, //1表示个人业绩排行 2门店 3区域
// // "end_day" => "",
// // "start_day" =>"",
// );
/* $params = array(
"type" => 1, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" => "",
);*/
$params["type"] = 1;
......
......@@ -157,8 +157,6 @@ class PerformanceInfo extends Basic
$where['Agent.phone'] = ['like', '%'.$this->params['phone'].'%'];
}
$field = 'Obargain.create_time,';
$field .= 'Obargain.trade_type,';
$field .= 'Houses.landmark,';
......@@ -178,7 +176,6 @@ class PerformanceInfo extends Basic
$export = new ExportExcelUntil();
foreach ($return as $key => $v) {
$e_data_old['create_time'] = $v['create_time'];//提交时间
......@@ -191,9 +188,8 @@ class PerformanceInfo extends Basic
}else{
$e_data_old['trade_type'] = "好处费";
}
$e_data_old['landmark'] = $v['landmark'];//商铺地址
$e_data_old['house_id'] = $v['house_id'];//商铺编号
$e_data_old['house_id'] = $v['house_id'];//商铺编号
$e_data_old['name_phone'] = $v['name'].'-'.$v['phone'];//分佣提成方
$e_data_old['district_name'] = $v['district_name'].'-'.$v['store_name'];//所属部门
$e_data_old['scale'] = $v['scale'];//分佣比例
......@@ -202,10 +198,7 @@ class PerformanceInfo extends Basic
$e_data_new[]=$e_data_old;
}
$title = [ '提交时间', '成交类型', '商铺地址', '商铺编号', '分佣提成方', '所属部门门店', '分佣比例', '应收佣金', '实收佣金' ];
$export->exportTable('业绩明细', $e_data_new, 10, '业绩明细表', $title);
return '';
}
......
......@@ -64,24 +64,15 @@ class PerformanceService
}
}
/*$where_ = [];
$where_['a.create_time'] = array( 'between', array( $end_day . " 00:00:00", $yesterday . " 23:59:59" ) );
$field = "b.id as agent_id,b.store_id,b.district_id,sum(a.scale_fee) as performance_total";
$order = "performance_total desc";
$result = $this->bargainModel->getTotalByAgentId($field, $where_, $type, $order);*/
$where_['total_time'] = array( 'between', array( $end_day, $yesterday ) );
//todo 成交报告数 bargain_sum
//todo 收款数 paylog
//todo 进场数 march_in_num
//todo 报备数 look_at_num
//todo 新增商铺数 add_house_num
//todo 新增客户数 add_user_num
//todo 团队人数 team_num
/* 成交报告数 bargain_sum
收款数 paylog
进场数 march_in_num
报备数 look_at_num
新增商铺数 add_house_num
新增客户数 add_user_num
团队人数 team_num*/
$field = "agent_id,store_id,district_id,
sum(performance) as performance_total,
......@@ -92,16 +83,10 @@ class PerformanceService
sum(add_house_num) as add_house_num_total,
sum(add_user_num) as add_user_num_total
";
// $field = "agent_id,store_id,district_id,sum(performance) as performance_total";
$order = "performance_total desc";
//dump($where_);
$result = $this->totalModel->getTotalByAgentId($field, $where_, $type, $order);
//dump($result);
$arr = [];
// $total = $this->totalModel->getTotalByAgentIdCount($field, $where_, $type, $order);
// $field = "a.name,a.img,b.store_name,c.district_name";
$field = "a.name,a.img,b.store_name,c.district_name";
foreach ($result as $key => $value) {
......@@ -115,43 +100,6 @@ class PerformanceService
$value["store_name"] = $info[0]["store_name"];
$value["district_name"] = $info[0]["district_name"];
//todo 计算当日业绩 performance_total
/* $where_ = [];
//$where_["district_id"] = $district_id;
$where_["agent_id"] = $value["agent_id"];
$where_['create_time'] = array( 'between', array( $end_day . " 00:00:00", $yesterday . " 23:59:59" ) );
$obargain = new OBargainModel();
//dump($where_);*/
//todo 计算当日成交单数 bargain_sum
/*$performanceSum = $obargain->getAddBargainNum($where_, 3);//1表示业绩 2表示实收
$value["bargain_sum_total"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;*/
//todo 计算当日收款数 paylog
/*$receivedSum = $this->bargainModel->getAddBargainNum($where_, 2);//1表示业绩 2表示实收
$value["paylog_total"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;*/
//todo 计算当日进场数 march_in_num
/* $addMarchInNum = $this->marchInModel->getAddMarchInNum($where_);
$value["march_in_num_total"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;*/
//todo 计算当日报备数 look_at_num
/*$reportNum = $this->reportModel->getAddReportNum($where_);
$value["look_at_num_total"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;*/
//todo 计算当日新增商铺数 add_house_num
/*$addHouseNum = $this->houseModel->getAddHouseNum($where_);
$value["add_house_num_total"] = isset($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;*/
//todo 计算当日新增客户数 add_user_num
/*$addUserNum = $this->userModel->getAddUserNum($where_);
$value["add_user_num_total"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;*/
array_push($arr, $value);
}
break;
......@@ -172,58 +120,6 @@ class PerformanceService
$params["status"] = 0; //只查询正常状态的经纪人
$value["team_num"] = $this->agentModel->getAgentsCountByStoreId($params);
//查询总监下面门店的所有经纪人
/*$params = [];
$params['store_id'] = $value["store_id"];
$params["status"] = 0; //只查询正常状态的经纪人
$agentsArr = $this->agentModel->getAgentsByStoreId($params);
$agent_total = count($agentsArr);
if ($agent_total > 0) {
$agentIds = "";
foreach ($agentsArr as $key1 => $value1) {
$agentIds .= $value1["id"] . ",";
}
$agentIds = rtrim($agentIds, ",");//经纪人ID集合
}//查询总监下面门店的所有经纪人 end
//todo 计算当日业绩 performance_total
$where_ = [];
//$where_["district_id"] = $district_id;
$where_["agent_id"] = array( "in", $agentIds );
$where_['create_time'] = array( 'between', array( $end_day . " 00:00:00", $yesterday . " 23:59:59" ) );
$obargain = new OBargainModel();
//dump($where_);*/
//todo 计算当日成交单数 bargain_sum
/*$performanceSum = $obargain->getAddBargainNum($where_, 3);//1表示业绩 2表示实收
$value["bargain_sum_total"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;*/
//todo 计算当日收款数 paylog
/*$receivedSum = $this->bargainModel->getAddBargainNum($where_, 2);//1表示业绩 2表示实收
$value["paylog_total"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;*/
//todo 计算当日进场数 march_in_num
/*$addMarchInNum = $this->marchInModel->getAddMarchInNum($where_);
$value["march_in_num_total"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;*/
//todo 计算当日报备数 look_at_num
/*$reportNum = $this->reportModel->getAddReportNum($where_);
$value["look_at_num_total"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;*/
//todo 计算当日新增商铺数 add_house_num
/*$addHouseNum = $this->houseModel->getAddHouseNum($where_);
$value["add_house_num_total"] = isset($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;*/
//todo 计算当日新增客户数 add_user_num
/*$addUserNum = $this->userModel->getAddUserNum($where_);
$value["add_user_num_total"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;*/
//dump($value);
array_push($arr, $value);
break;
......@@ -243,62 +139,12 @@ class PerformanceService
$params["status"] = 0; //只查询正常状态的经纪人
$value["team_num"] = $this->agentModel->getAgentsCountByStoreId($params);
//查询总监下面门店的所有经纪人
/* $params = [];
$params["district_id"] = $value["district_id"];
$params["status"] = 0; //只查询正常状态的经纪人
$agentsArr = $this->agentModel->getAgentsByStoreId($params);
$agent_total = count($agentsArr);
if ($agent_total > 0) {
$agentIds = "";
foreach ($agentsArr as $key1 => $value1) {
$agentIds .= $value1["id"] . ",";
}
$agentIds = rtrim($agentIds, ",");//经纪人ID集合
}//查询总监下面门店的所有经纪人 end
//todo 计算当日业绩 performance_total
$where_ = [];
//$where_["district_id"] = $district_id;
$where_["agent_id"] = array( "in", $agentIds );
$where_['create_time'] = array( 'between', array( $end_day . " 00:00:00", $yesterday . " 23:59:59" ) );
$obargain = new OBargainModel();*/
//todo 计算当日成交单数 bargain_sum
/* $performanceSum = $obargain->getAddBargainNum($where_, 3);//1表示业绩 2表示实收
$value["bargain_sum_total"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;*/
//todo 计算当日收款数 paylog
/*$receivedSum = $this->bargainModel->getAddBargainNum($where_, 2);//1表示业绩 2表示实收
$value["paylog_total"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;*/
//todo 计算当日进场数 march_in_num
/*$addMarchInNum = $this->marchInModel->getAddMarchInNum($where_);
$value["march_in_num_total"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;*/
//todo 计算当日报备数 look_at_num
/*$reportNum = $this->reportModel->getAddReportNum($where_);
$value["look_at_num_total"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;*/
//todo 计算当日新增商铺数 add_house_num
/*$addHouseNum = $this->houseModel->getAddHouseNum($where_);
$value["add_house_num_total"] = isset($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;*/
//todo 计算当日新增客户数 add_user_num
/*$addUserNum = $this->userModel->getAddUserNum($where_);
$value["add_user_num_total"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;*/
array_push($arr, $value);
break;
}
}
//dump($arr);exit;
Session::set('excelPerformance',['data'=>$arr,'type'=>$type]);
return ['list'=>$arr,'total'=>0];
}
......
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