Commit f965cf59 authored by zhuwei's avatar zhuwei

业绩排名正序倒叙优化

parent 8cc4110a
...@@ -55,8 +55,8 @@ class PerformanceService ...@@ -55,8 +55,8 @@ class PerformanceService
*/ */
public function totalAgent($type, $yesterday, $end_day,$pageNo,$pageSize,$father_id,$params) public function totalAgent($type, $yesterday, $end_day,$pageNo,$pageSize,$father_id,$params)
{ {
$order_ = $params['order'];
$where_ = []; $where_ = [];
if($father_id){ if($father_id){
if($type == 1){ if($type == 1){
$where_['store_id'] = $father_id; $where_['store_id'] = $father_id;
...@@ -109,9 +109,14 @@ class PerformanceService ...@@ -109,9 +109,14 @@ class PerformanceService
$num = ($pageNo - 1) * 10; $num = ($pageNo - 1) * 10;
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
switch ($type) { switch ($type) {
case 1: case 1:
if ($order_ == 'desc') {
$value["index_"] = $key + 1 + $num; $value["index_"] = $key + 1 + $num;
} else {
$value["index_"] = $total_result - $key - $num;
}
$info = $this->agentModel->getAgentsInfoByAgentId($field, [ "agent_id" => $value["agent_id"] ]); $info = $this->agentModel->getAgentsInfoByAgentId($field, [ "agent_id" => $value["agent_id"] ]);
if (count($info) > 0) { if (count($info) > 0) {
$value["name"] = $info[0]["name"]; $value["name"] = $info[0]["name"];
...@@ -123,7 +128,11 @@ class PerformanceService ...@@ -123,7 +128,11 @@ class PerformanceService
} }
break; break;
case 2: case 2:
if ($order_ == 'desc') {
$value["index_"] = $key + 1 + $num; $value["index_"] = $key + 1 + $num;
} else {
$value["index_"] = $total_result - $key - $num;
}
$info = $this->agentModel->getAgentsInfoByAgentId($field, [ "agent_id" => $value["agent_id"], "" ]); $info = $this->agentModel->getAgentsInfoByAgentId($field, [ "agent_id" => $value["agent_id"], "" ]);
$store_name = $this->agentModel->getStoreOrDistrict([ "store_id" => $value["store_id"], "level" => 20 ]); $store_name = $this->agentModel->getStoreOrDistrict([ "store_id" => $value["store_id"], "level" => 20 ]);
if (count($info) > 0) { if (count($info) > 0) {
...@@ -143,7 +152,11 @@ class PerformanceService ...@@ -143,7 +152,11 @@ class PerformanceService
break; break;
case 3: case 3:
if ($order_ == 'desc') {
$value["index_"] = $key + 1 + $num; $value["index_"] = $key + 1 + $num;
} else {
$value["index_"] = $total_result - $key - $num;
}
$info = $this->agentModel->getAgentsInfoByAgentId($field, [ "agent_id" => $value["agent_id"] ]); $info = $this->agentModel->getAgentsInfoByAgentId($field, [ "agent_id" => $value["agent_id"] ]);
$district_name = $this->agentModel->getStoreOrDistrict([ "district_id" => $value["district_id"], "level" => [ "in", "30,40" ] ]); $district_name = $this->agentModel->getStoreOrDistrict([ "district_id" => $value["district_id"], "level" => [ "in", "30,40" ] ]);
if (count($info) > 0) { if (count($info) > 0) {
...@@ -152,11 +165,12 @@ class PerformanceService ...@@ -152,11 +165,12 @@ class PerformanceService
$value["store_name"] = $info[0]["store_name"]; $value["store_name"] = $info[0]["store_name"];
$value["district_name"] = $info[0]["district_name"]; $value["district_name"] = $info[0]["district_name"];
} }
//计算区域人数 //计算区域人数
$params = []; $params_ = [];
$params['district_id'] = $value["district_id"]; $params_['district_id'] = $value["district_id"];
$params["status"] = 0; //只查询正常状态的经纪人 $params_["status"] = 0; //只查询正常状态的经纪人
$value["team_num"] = $this->agentModel->getAgentsCountByStoreId($params); $value["team_num"] = $this->agentModel->getAgentsCountByStoreId($params_);
array_push($arr, $value); array_push($arr, $value);
break; break;
...@@ -183,7 +197,7 @@ class PerformanceService ...@@ -183,7 +197,7 @@ class PerformanceService
* @param string $agent_id * @param string $agent_id
* @return int] * @return int]
*/ */
public function getRanking($type, $yesterday, $end_day,$pageNo,$pageSize,$params,$agent_id='5740') public function getRanking($type, $yesterday, $end_day,$pageNo,$pageSize,$params,$agent_id)
{ {
$where_ = []; $where_ = [];
......
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