6
0
Fork 0

调整首页用户统计图

release
vine_liutk 2021-12-31 16:35:41 +08:00
parent 047f75e02d
commit 6eed51596f
1 changed files with 9 additions and 2 deletions

View File

@ -52,8 +52,14 @@ class Users extends Donut
$nums = UserInfo::selectRaw('count(1) as num, agent_level')->groupBy('agent_level')->pluck('num', 'agent_level')->toArray();
$this->withContent($nums);
// dd($nums);
foreach (UserInfo::$agentLevelRanks as $rank) {
if (!isset($nums[$rank])) {
$nums[$rank] = 0;
}
}
// 图表数据
$this->withChart(array_merge($nums, []));
ksort($nums);
$this->withChart($nums);
}
/**
@ -65,8 +71,9 @@ class Users extends Donut
*/
public function withChart(array $data)
{
// dd($data);
return $this->chart([
'series' => $data,
'series' => array_values($data),
]);
}