From 29e364f74a19b74efc410492afa75bf2628c374e Mon Sep 17 00:00:00 2001 From: leon <916117771@qq.com> Date: Wed, 22 Apr 2026 00:01:20 +0800 Subject: [PATCH] feat: add comprehensive dashboard showing all analysis metrics in one view --- application/admin/controller/History.php | 21 +++- application/admin/lang/zh-cn/history.php | 1 + application/admin/model/History.php | 16 +++ application/admin/view/history/index.html | 1 + public/assets/js/backend/history.js | 142 ++++++++++++++++++++++ 5 files changed, 180 insertions(+), 1 deletion(-) diff --git a/application/admin/controller/History.php b/application/admin/controller/History.php index f640245..dc1f0b0 100644 --- a/application/admin/controller/History.php +++ b/application/admin/controller/History.php @@ -22,7 +22,7 @@ class History extends Backend * 无需额外权限检查的方法(但仍在 admin 模块内,需要 admin 登录) * @var array */ - protected $noNeedRight = ['missingNum', 'trendData', 'hotColdNumbers', 'colorWaveAnalysis', 'zodiacAnalysis', 'oddEvenAnalysis', 'bigSmallAnalysis', 'sumAnalysis', 'consecutiveNumbers', 'tailNumbers']; + protected $noNeedRight = ['missingNum', 'trendData', 'hotColdNumbers', 'colorWaveAnalysis', 'zodiacAnalysis', 'oddEvenAnalysis', 'bigSmallAnalysis', 'sumAnalysis', 'consecutiveNumbers', 'tailNumbers', 'dashboard']; public function _initialize() { @@ -217,5 +217,24 @@ class History extends Backend } } + /** + * 综合统计面板 + */ + public function dashboard() + { + if ($this->request->isAjax()) { + $periods = $this->request->get('periods', 30, 'intval'); + if ($periods < 10 || $periods > 100) { + $this->error('期数范围必须在 10-100 之间'); + } + $type = $this->request->get('type', 'all'); + if (!in_array($type, ['all', 'special'])) { + $this->error('查询类型不正确'); + } + $result = $this->model->getDashboardData($periods, $type); + $this->success('查询成功', null, $result); + } + } + } diff --git a/application/admin/lang/zh-cn/history.php b/application/admin/lang/zh-cn/history.php index 5d2cbd0..84a9f1a 100644 --- a/application/admin/lang/zh-cn/history.php +++ b/application/admin/lang/zh-cn/history.php @@ -25,4 +25,5 @@ return [ 'Sum Chart' => '和值分析', 'Consecutive' => '连号分析', 'Tail Numbers' => '尾数分析', + 'Dashboard' => '综合统计面板', ]; diff --git a/application/admin/model/History.php b/application/admin/model/History.php index 5d7b4c1..6b2827a 100644 --- a/application/admin/model/History.php +++ b/application/admin/model/History.php @@ -446,5 +446,21 @@ class History extends Model return ['all' => $all]; } + /** + * 综合统计面板 + */ + public function getDashboardData($periods = 30, $type = 'all') + { + return [ + 'hotcold' => $this->getHotColdNumbers($periods, $type), + 'colorwave' => $this->getColorWaveAnalysis($periods, $type), + 'zodiac' => $this->getZodiacAnalysis($periods, $type), + 'oddeven' => $this->getOddEvenAnalysis($periods, $type), + 'bigsmall' => $this->getBigSmallAnalysis($periods, $type), + 'sum' => $this->getSumAnalysis($periods), + 'tailnumbers' => $this->getTailNumbers($periods, $type) + ]; + } + } diff --git a/application/admin/view/history/index.html b/application/admin/view/history/index.html index 55c09d0..44ff12c 100644 --- a/application/admin/view/history/index.html +++ b/application/admin/view/history/index.html @@ -17,6 +17,7 @@ {:__('Sum Chart')} {:__('Consecutive')} {:__('Tail Numbers')} + {:__('Dashboard')}