Commit f965cf59 authored by zhuwei's avatar zhuwei

业绩排名正序倒叙优化

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