Commit 229927ee authored by zhuwei's avatar zhuwei

1

parent b9de9ede
......@@ -50,7 +50,7 @@ class Statement extends Basic
$time_end = $params["time_end"] . " 23:59:59";
try {
$result = $this->service_->selectStatementByAgentId($params["agent_id"], $params["time_start"], $time_end,$day_or_week);
$result = $this->service_->selectStatementByAgentId($params["agent_id"], $params["time_start"], $time_end,$day_or_week,$this->siteId);
if (count($result) > 0) {
return $this->response("200", "request success", $result);
......
......@@ -9,6 +9,7 @@ use app\model\GHousesToAgents;
use app\model\OBargainModel;
use app\model\OMarchInModel;
use app\model\OReportModel;
use app\model\UPhoneFollowUpTemporary;
use app\model\Users;
/**
......@@ -58,13 +59,12 @@ class StatementService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectStatementByAgentId($agent_id, $time_start, $time_end, $day_or_week)
public function selectStatementByAgentId($agent_id, $time_start, $time_end, $day_or_week,$site_id)
{
$field = "id,store_id,district_id,level,name,phone,sex,status";
$agent_result = $this->agentModel->getAgentById($field, [ "agent_id" => $agent_id ]);
//dump($agent_result);
if (count($agent_result) <= 0) {
return null;
......@@ -81,7 +81,7 @@ class StatementService
$conditions["agent_id"] = $agent_id;
$conditions['create_time'] = array( 'between', array( $time_start, $time_end ) );
return $this->selectStatement($conditions, $user_type, $store_id, $district_id, $day_or_week,$agent_id);
return $this->selectStatement($conditions, $user_type, $store_id, $district_id, $day_or_week,$agent_id,$site_id);
}
......@@ -93,7 +93,7 @@ class StatementService
* @param $district_id
* @return array
*/
private function selectStatement($conditions, $user_type, $store_id, $district_id, $day_or_week,$agent_id)
private function selectStatement($conditions, $user_type, $store_id, $district_id, $day_or_week,$agent_id,$site_id)
{
//房源 客源 带看 月完成
......@@ -123,7 +123,7 @@ class StatementService
$agentIds .= $value["id"] . ",";
#列表排除长假经纪人
if ($user_type == 1 and $value['status']==0) {//1店长
array_push($store_list, $this->getStoreList($conditions, $value["id"], $value["name"]));
array_push($store_list, $this->getStoreList($conditions, $value["id"], $value["name"],$site_id));
}
}
$agentIds = rtrim($agentIds, ",");
......@@ -148,6 +148,10 @@ class StatementService
$result["agent_total"] = count($agents_res);
$result["house_num"] = $this->housesToAgents->getAddHouseNumByAgentId($conditions);
$result["user_num"] = $this->userModel->getAddUserNumByAgentIdV2($conditions);
$m_phone_follow_up = new UPhoneFollowUpTemporary($site_id);
$phone_follow_up_num = $m_phone_follow_up->getFollowTotal($conditions);
$result["phone_follow_up_num"] = $phone_follow_up_num;
//本周带看(报备)
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions);
$result["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
......@@ -367,7 +371,7 @@ class StatementService
* @param $agent_name
* @return mixed
*/
private function getStoreList($conditions, $agent_id, $agent_name)
private function getStoreList($conditions, $agent_id, $agent_name,$site_id)
{
$conditions_ = $conditions;
$conditions_["agent_id"] = $agent_id;
......@@ -380,6 +384,10 @@ class StatementService
$addMarchInNum = $this->marchInModel->getAddMarchInNum($conditions_);
$store_list["follow_up_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
$m_phone_follow_up = new UPhoneFollowUpTemporary($site_id);
$phone_follow_up_num = $m_phone_follow_up->getFollowTotal($conditions_);
$store_list["phone_follow_up_num"] = $phone_follow_up_num;
//本周业绩
$start_time = date("Y-m-d", strtotime("-6 day"));
$end_time = date("Y-m-d");
......@@ -395,6 +403,8 @@ class StatementService
//客源
$addUserNum = $this->userModel->getAddUserNum($where_);
$store_list["add_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
return $store_list;
}
......
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