Commit 84c72911 authored by zw's avatar zw

分区业绩杭州

parent 233d835b
......@@ -31,8 +31,8 @@ class RankingList extends Basic{
*/
public function getRandKingList(){
$params = $this->params;
/* $params["position"] = 1;//职称 1店长 2经理 3主任 4顾问 0新人
$this->siteId = 10001;*/
$params["position"] = 1;//职称 1店长 2经理 3主任 4顾问 0新人
$this->siteId = 10002;
if(!isset($params["position"]) || $params["position"] < 0 || $params["position"] > 5){
return $this->response("101","请求参数错误");
}
......
......@@ -26,8 +26,14 @@ class RankingListService
{
$this->agentModel = new AAgents();
$this->agentTotalModel = new TAgentTotalModel();
$this->crewNum = 20;
$this->crewNumMax = 25;
$this->crewNum = array(
"10001"=>20,
"10002"=>8
);
$this->crewNumMax = array(
"10001" => 25,
"10002" => 10
);
}
......@@ -54,7 +60,7 @@ class RankingListService
}
//分组
$result = $this->group($resultArr);
$result = $this->group($resultArr,$siteId);
//循环分组后的数组,查询出各组本月业绩排行
//本月
......@@ -82,20 +88,21 @@ class RankingListService
/**
* @param $resultArr
* @param $siteId
* @return array
*/
private function group($resultArr){
private function group($resultArr,$siteId){
//分组
$total = count($resultArr);
$total_page = floor($total / $this->crewNum);
$residue = $total % $this->crewNum;
$full = $total_page * ($this->crewNumMax - $this->crewNum);
$x = $this->crewNum;
$total_page = floor($total / $this->crewNum[$siteId]);
$residue = $total % $this->crewNum[$siteId];
$full = $total_page * ($this->crewNumMax[$siteId] - $this->crewNum[$siteId]);
$x = $this->crewNum[$siteId];
$y = $total_page;
if ($full < $residue) {
$y = $y + 1;
} else {
$x = ceil($residue / $total_page) + $this->crewNum;
$x = ceil($residue / $total_page) + $this->crewNum[$siteId];
}
$result = [];
$i = 0;
......@@ -142,7 +149,7 @@ class RankingListService
}
//分组
$result = $this->group($resultArr);
$result = $this->group($resultArr,$siteId);
//循环分组后的数组,查询出各组本月业绩排行
//本月
......
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