Commit 86b07e35 authored by zhuwei's avatar zhuwei

店长日报

parent 33675822
...@@ -254,33 +254,38 @@ class Statement extends Basic ...@@ -254,33 +254,38 @@ class Statement extends Basic
$store_id = $agent_result[0]["store_id"]; $store_id = $agent_result[0]["store_id"];
$district_id = $agent_result[0]["district_id"]; $district_id = $agent_result[0]["district_id"];
dump($agent_result[0]["level"]);
if ($agent_result[0]["level"] == 10) { switch ($agent_result[0]["level"]) {
#业务员 case 10:
$agent_level = 0; #业务员
$result = $this->service_->selectStatementForClerk($params["agent_id"], $agent_level, $store_id,$district_id); $agent_level = 0;
} elseif ($agent_result[0]["level"] == 20) { $result = $this->service_->selectStatementForClerk($params["agent_id"], $agent_level, $store_id,
#店长 $district_id);
$agent_level = 1; break;
if($params["type"] == 0 ) { case 20:
#日报 #店长
$result = $this->service_->selectStatementForStoreWithDay($params["agent_id"], $agent_level, $store_id,$district_id,$this->siteId); $agent_level = 1;
}else{ if($params["type"] == 0 ) {//日报
#周报 $result = $this->service_->selectStatementForStoreWithDay($params["agent_id"], $agent_level,
$result = $this->service_->selectStatementForStoreWithWeek($params["agent_id"], $agent_level, $store_id,$district_id); $store_id,$district_id,$this->siteId);
} }else{//周报
} else { $result = $this->service_->selectStatementForStoreWithWeek($params["agent_id"], $agent_level,
#总监 $store_id,$district_id);
$agent_level = 2; }
if($params["type"] == 0 ){ break;
#日报 default:
$result = $this->service_->selectStatementForDistrictWithDay($params["agent_id"], $agent_level, $store_id,$district_id); #总监
}else{ $agent_level = 2;
#周报 if($params["type"] == 0 ){ #日报
$result = $this->service_->selectStatementForDistrictWithWeek($params["agent_id"], $agent_level, $store_id,$district_id); $result = $this->service_->selectStatementForDistrictWithDay($params["agent_id"], $agent_level,
} $store_id,$district_id);
}else{ #周报
$result = $this->service_->selectStatementForDistrictWithWeek($params["agent_id"], $agent_level,
$store_id,$district_id);
}
} }
if ($result) { if ($result) {
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} else { } else {
......
...@@ -619,13 +619,13 @@ class StatementService ...@@ -619,13 +619,13 @@ class StatementService
} }
/** /**
* 查询店长门店日报数据 * 店长日报 6666666
* @param $agent_id * @param $agent_id
* @param $agent_level * @param $agent_level
* @param $store_id * @param $store_id
* @param $district_id * @param $district_id
* @return mixed user 朱伟 * @return mixed user 朱伟
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=698 * http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=699
*/ */
public function selectStatementForStoreWithDay($agent_id, $agent_level, $store_id, $district_id,$site_id) public function selectStatementForStoreWithDay($agent_id, $agent_level, $store_id, $district_id,$site_id)
{ {
...@@ -640,14 +640,14 @@ class StatementService ...@@ -640,14 +640,14 @@ class StatementService
// 房源 // 房源
$result["team_house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions); $result["team_house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
// 客源 // 客源
$result["team_user_num"] = $this->userModel->getAddUserNumByAgentId($conditions); $result["team_user_num"] = $this->userModel->getAddUserNumByAgentIdV2($conditions);
// 带看 (报备) // 带看 (报备)
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions); $addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["team_follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0; $result["team_follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// 业绩 // 业绩
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收 $performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$result["team_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0; $result["team_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// 实收666666666666 // 实收
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 2);//1表示业绩 2表示实收 $performanceSum = $this->bargainModel->getAddBargainNum($conditions, 2);//1表示业绩 2表示实收
$result["team_real_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0; $result["team_real_performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
...@@ -659,7 +659,7 @@ class StatementService ...@@ -659,7 +659,7 @@ class StatementService
// 房源 // 房源
$result["team_month_house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions); $result["team_month_house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
// 客源 // 客源
$result["team_month_user_num"] = $this->userModel->getAddUserNumByAgentId($conditions); $result["team_month_user_num"] = $this->userModel->getAddUserNumByAgentIdV2($conditions);
// 带看 (报备) // 带看 (报备)
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions); $addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["team_month_follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0; $result["team_month_follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
...@@ -684,7 +684,7 @@ class StatementService ...@@ -684,7 +684,7 @@ class StatementService
//房源 //房源
$result["self_house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions); $result["self_house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
//客源 //客源
$result["self_user_num"] = $this->userModel->getAddUserNumByAgentId($conditions); $result["self_user_num"] = $this->userModel->getAddUserNumByAgentIdV2($conditions);
//带看(报备) //带看(报备)
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions); $addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["self_follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0; $result["self_follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
...@@ -693,11 +693,21 @@ class StatementService ...@@ -693,11 +693,21 @@ class StatementService
$m_phone_follow_up = new UPhoneFollowUpTemporary($site_id); $m_phone_follow_up = new UPhoneFollowUpTemporary($site_id);
$result["self_phone_follow_up_num"] = $m_phone_follow_up->getFollowTotal($conditions); $result["self_phone_follow_up_num"] = $m_phone_follow_up->getFollowTotal($conditions);
#成交单数
// $performanceSum = $this->bargainModel->getAddBargainNumV2($conditions, 3);//1表示业绩 2表示实收 3成交单数
// $result["bargain_sum_by_self"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
/**查询店长旗下业务员数据**/ /**查询店长旗下业务员数据**/
foreach ($agent_res['store_list'] as $k => $v) {
$conditions['agent_id'] = $v["id"];
// 房源
$agent_res['store_list'][$k]["house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
// 客源
$agent_res['store_list'][$k]["user_num"] = $this->userModel->getAddUserNumByAgentIdV2($conditions);
// 带看
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$agent_res['store_list'][$k]["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// 业绩
$performanceSum = $this->bargainModel->getAddBargainNum($conditions, 1);//1表示业绩 2表示实收
$agent_res['store_list'][$k]["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
}
$result["store_list"] = $agent_res['store_list']; $result["store_list"] = $agent_res['store_list'];
$result["store_list_num"] = $agent_res['store_list_num']; $result["store_list_num"] = $agent_res['store_list_num'];
......
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