From 6eed51596fa5b6bdfc2c688636c61d2243bca2e0 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Fri, 31 Dec 2021 16:35:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A6=96=E9=A1=B5=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=9F=E8=AE=A1=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Metrics/Users.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Admin/Metrics/Users.php b/app/Admin/Metrics/Users.php index 03f50099..53c34465 100644 --- a/app/Admin/Metrics/Users.php +++ b/app/Admin/Metrics/Users.php @@ -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), ]); }