From 6e2e4cdc989493d4ff59ba84abc48634d333e994 Mon Sep 17 00:00:00 2001 From: leon <916117771@qq.com> Date: Wed, 22 Apr 2026 00:03:57 +0800 Subject: [PATCH] feat: rewrite dashboard page as lottery data dashboard with all analysis metrics --- application/admin/controller/Dashboard.php | 69 +-- application/admin/lang/zh-cn/history.php | 1 + application/admin/view/dashboard/index.html | 540 ++++++-------------- 3 files changed, 149 insertions(+), 461 deletions(-) diff --git a/application/admin/controller/Dashboard.php b/application/admin/controller/Dashboard.php index 2dd2e06..b8c74af 100644 --- a/application/admin/controller/Dashboard.php +++ b/application/admin/controller/Dashboard.php @@ -2,83 +2,18 @@ namespace app\admin\controller; -use app\admin\model\Admin; -use app\admin\model\User; use app\common\controller\Backend; -use app\common\model\Attachment; -use fast\Date; -use think\Db; /** - * 控制台 + * 控制台 - 六合彩数据分析 * * @icon fa fa-dashboard - * @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据 */ class Dashboard extends Backend { - - /** - * 查看 - */ public function index() { - try { - \think\Db::execute("SET @@sql_mode='';"); - } catch (\Exception $e) { - - } - $column = []; - $starttime = Date::unixtime('day', -6); - $endtime = Date::unixtime('day', 0, 'end'); - $joinlist = Db("user")->where('jointime', 'between time', [$starttime, $endtime]) - ->field('jointime, status, COUNT(*) AS nums, DATE_FORMAT(FROM_UNIXTIME(jointime), "%Y-%m-%d") AS join_date') - ->group('join_date') - ->select(); - for ($time = $starttime; $time <= $endtime;) { - $column[] = date("Y-m-d", $time); - $time += 86400; - } - $userlist = array_fill_keys($column, 0); - foreach ($joinlist as $k => $v) { - $userlist[$v['join_date']] = $v['nums']; - } - - $dbTableList = Db::query("SHOW TABLE STATUS"); - $addonList = get_addon_list(); - $totalworkingaddon = 0; - $totaladdon = count($addonList); - foreach ($addonList as $index => $item) { - if ($item['state']) { - $totalworkingaddon += 1; - } - } - $this->view->assign([ - 'totaluser' => User::count(), - 'totaladdon' => $totaladdon, - 'totaladmin' => Admin::count(), - 'totalcategory' => \app\common\model\Category::count(), - 'todayusersignup' => User::whereTime('jointime', 'today')->count(), - 'todayuserlogin' => User::whereTime('logintime', 'today')->count(), - 'sevendau' => User::whereTime('jointime|logintime|prevtime', '-7 days')->count(), - 'thirtydau' => User::whereTime('jointime|logintime|prevtime', '-30 days')->count(), - 'threednu' => User::whereTime('jointime', '-3 days')->count(), - 'sevendnu' => User::whereTime('jointime', '-7 days')->count(), - 'dbtablenums' => count($dbTableList), - 'dbsize' => array_sum(array_map(function ($item) { - return $item['Data_length'] + $item['Index_length']; - }, $dbTableList)), - 'totalworkingaddon' => $totalworkingaddon, - 'attachmentnums' => Attachment::count(), - 'attachmentsize' => Attachment::sum('filesize'), - 'picturenums' => Attachment::where('mimetype', 'like', 'image/%')->count(), - 'picturesize' => Attachment::where('mimetype', 'like', 'image/%')->sum('filesize'), - ]); - - $this->assignconfig('column', array_keys($userlist)); - $this->assignconfig('userdata', array_values($userlist)); - + $this->assign('periods', 30); return $this->view->fetch(); } - } diff --git a/application/admin/lang/zh-cn/history.php b/application/admin/lang/zh-cn/history.php index 84a9f1a..f4d3a4f 100644 --- a/application/admin/lang/zh-cn/history.php +++ b/application/admin/lang/zh-cn/history.php @@ -26,4 +26,5 @@ return [ 'Consecutive' => '连号分析', 'Tail Numbers' => '尾数分析', 'Dashboard' => '综合统计面板', + 'Refresh' => '刷新', ]; diff --git a/application/admin/view/dashboard/index.html b/application/admin/view/dashboard/index.html index 1b0bc3a..215e172 100644 --- a/application/admin/view/dashboard/index.html +++ b/application/admin/view/dashboard/index.html @@ -1,403 +1,155 @@ +