Commit df5a2a32 authored by zhuwei's avatar zhuwei

业绩修改

parent 8874329e
...@@ -35,8 +35,8 @@ class Statement extends Basic ...@@ -35,8 +35,8 @@ class Statement extends Basic
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
/* $params = array( /*$params = array(
"agent_id" => 5739, "agent_id" => 5740,
"time_start" => date("Y-m-d", time()), "time_start" => date("Y-m-d", time()),
"time_end" => date("Y-m-d", time()) . " 23:59:59", "time_end" => date("Y-m-d", time()) . " 23:59:59",
);*/ );*/
...@@ -48,6 +48,7 @@ class Statement extends Basic ...@@ -48,6 +48,7 @@ class Statement extends Basic
$time_end = $params["time_end"] . " 23:59:59"; $time_end = $params["time_end"] . " 23:59:59";
try { try {
$result = $this->service_->selectStatementByAgentId($params["agent_id"], $params["time_start"], $time_end); $result = $this->service_->selectStatementByAgentId($params["agent_id"], $params["time_start"], $time_end);
if (count($result) > 0) { if (count($result) > 0) {
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} else { } else {
......
...@@ -54,7 +54,6 @@ class StatementService ...@@ -54,7 +54,6 @@ class StatementService
$field = "id,store_id,district_id,level,name,phone,sex,status"; $field = "id,store_id,district_id,level,name,phone,sex,status";
$agent_result = $this->agentModel->getAgentById($field, [ "agent_id" => $agent_id ]); $agent_result = $this->agentModel->getAgentById($field, [ "agent_id" => $agent_id ]);
if (count($agent_result) <= 0) { if (count($agent_result) <= 0) {
return null; return null;
} }
...@@ -108,7 +107,6 @@ class StatementService ...@@ -108,7 +107,6 @@ class StatementService
if (!empty($params)) { if (!empty($params)) {
$agentsArr = $this->agentModel->getAgentsByStoreId($params); $agentsArr = $this->agentModel->getAgentsByStoreId($params);
$agent_total = count($agentsArr); $agent_total = count($agentsArr);
//dump($agentsArr);
if ($agent_total > 0) { if ($agent_total > 0) {
$agentIds = ""; $agentIds = "";
foreach ($agentsArr as $key => $value) { foreach ($agentsArr as $key => $value) {
...@@ -183,6 +181,8 @@ class StatementService ...@@ -183,6 +181,8 @@ class StatementService
*/ */
private function getStoreList($conditions, $agent_id, $agent_name) private function getStoreList($conditions, $agent_id, $agent_name)
{ {
//dump($conditions);
$conditions_ = $conditions; $conditions_ = $conditions;
$conditions_["agent_id"] = $agent_id; $conditions_["agent_id"] = $agent_id;
//是门店 统计个人业绩 //是门店 统计个人业绩
...@@ -192,6 +192,19 @@ class StatementService ...@@ -192,6 +192,19 @@ class StatementService
$store_list["user_num"] = $this->userModel->getAddUserNumByAgentId($conditions_); $store_list["user_num"] = $this->userModel->getAddUserNumByAgentId($conditions_);
//$store_list["follow_up_num"] = $this->followUpModel->getAddFollowUpNumByAgentId($conditions_); //$store_list["follow_up_num"] = $this->followUpModel->getAddFollowUpNumByAgentId($conditions_);
$store_list["follow_up_num"] = $this->reportModel->getAddFollowUpNumByAgentId($conditions_); $store_list["follow_up_num"] = $this->reportModel->getAddFollowUpNumByAgentId($conditions_);
//本周业绩
$start_time = date("Y-m-d", strtotime("-7 day"));
$end_time = date("Y-m-d", strtotime("-1 day"));
$where_['create_time'] = ['between', [$start_time . " 00:00:00", $end_time . " 23:59:59"]];
$obargain = new OBargainModel();
$performanceSum = $obargain->getAddBargainNum($where_, 1);//1表示业绩 2表示实收
$store_list["performance_week"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//客源
$addUserNum = $this->userModel->getAddUserNum($where_);
$store_list["add_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
return $store_list; return $store_list;
} }
...@@ -222,6 +235,7 @@ class StatementService ...@@ -222,6 +235,7 @@ class StatementService
$paramArr["store_id"] = $value["store_id"]; $paramArr["store_id"] = $value["store_id"];
$paramArr["level"] = array( "in", [ 20, 40 ] ); $paramArr["level"] = array( "in", [ 20, 40 ] );
$agentsResult = $this->agentModel->getAgentsByStoreId($paramArr); $agentsResult = $this->agentModel->getAgentsByStoreId($paramArr);
//dump($agentsResult);
$results[$key]["name"] = count($agentsResult) > 0 ? $agentsResult[0]["name"] : null; $results[$key]["name"] = count($agentsResult) > 0 ? $agentsResult[0]["name"] : null;
foreach ($result as $i => $item) { foreach ($result as $i => $item) {
if ($value["store_id"] == $item["store_id"]) { if ($value["store_id"] == $item["store_id"]) {
......
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