Browse Source

优化控制台统计

Karson 3 years ago
parent
commit
cd60f5f381

+ 25 - 16
application/admin/controller/Dashboard.php

@@ -45,25 +45,34 @@ class Dashboard extends Backend
         }
 
         $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'      => count(get_addon_list()),
-            '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) {
+            '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)),
-            'attachmentnums'  => Attachment::count(),
-            'attachmentsize'  => Attachment::sum('filesize'),
-            'picturenums'     => Attachment::where('mimetype', 'like', 'image/%')->count(),
-            'picturesize'     => Attachment::where('mimetype', 'like', 'image/%')->sum('filesize'),
+            '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));

+ 46 - 43
application/admin/lang/zh-cn/dashboard.php

@@ -1,47 +1,50 @@
 <?php
 
 return [
-    'Custom'                  => '自定义',
-    'Pid'                     => '父ID',
-    'Type'                    => '栏目类型',
-    'Image'                   => '图片',
-    'Total user'              => '总会员数',
-    'Total addon'             => '总插件数',
-    'Total category'          => '总分类数',
-    'Total admin'             => '总管理员数',
-    'Today user signup'       => '今日注册',
-    'Today user login'        => '今日登录',
-    'Today order'             => '今日订单',
-    'Unsettle order'          => '未处理订单',
-    'Three dnu'               => '三日新增',
-    'Seven dnu'               => '七日新增',
-    'Seven dau'               => '七日活跃',
-    'Thirty dau'              => '月活跃',
-    'Custom zone'             => '这里是你的自定义数据',
-    'Register user'           => '注册用户数',
-    'Real time'               => '实时',
-    'Category count'          => '分类统计',
-    'Category count tips'     => '当前分类总记录数',
-    'Database count'          => '数据库统计',
-    'Database table nums'     => '数据表数量',
-    'Database size'           => '占用空间',
-    'Attachment count'        => '附件统计',
-    'Attachment nums'         => '附件数量',
-    'Attachment size'         => '附件大小',
-    'Attachment count tips'   => '当前上传的附件数量',
-    'Picture count'           => '图片统计',
-    'Picture nums'            => '图片数量',
-    'Picture size'            => '图片大小',
-    'Server info'             => '服务器信息',
-    'PHP version'             => 'PHP版本',
-    'Sapi name'               => '运行方式',
-    'Debug mode'              => '调试模式',
-    'Software'                => '环境信息',
-    'Upload mode'             => '上传模式',
-    'Upload url'              => '上传URL',
-    'Upload cdn url'          => '上传CDN',
-    'Cdn url'                 => '静态资源CDN',
-    'Timezone'                => '时区',
-    'Language'                => '语言',
-    'View more'               => '查看更多',
+    'Custom'                   => '自定义',
+    'Pid'                      => '父ID',
+    'Type'                     => '栏目类型',
+    'Image'                    => '图片',
+    'Total user'               => '总会员数',
+    'Total addon'              => '总插件数',
+    'Total category'           => '总分类数',
+    'Total attachment'         => '总附件数',
+    'Total admin'              => '总管理员数',
+    'Today user signup'        => '今日注册',
+    'Today user login'         => '今日登录',
+    'Today order'              => '今日订单',
+    'Unsettle order'           => '未处理订单',
+    'Three dnu'                => '三日新增',
+    'Seven dnu'                => '七日新增',
+    'Seven dau'                => '七日活跃',
+    'Thirty dau'               => '月活跃',
+    'Custom zone'              => '这里是你的自定义数据',
+    'Register user'            => '注册用户数',
+    'Real time'                => '实时',
+    'Category count'           => '分类统计',
+    'Working addon count'      => '运行中的插件',
+    'Category count tips'      => '当前分类总记录数',
+    'Working addon count tips' => '当前运行中的插件数',
+    'Database count'           => '数据库统计',
+    'Database table nums'      => '数据表数量',
+    'Database size'            => '占用空间',
+    'Attachment count'         => '附件统计',
+    'Attachment nums'          => '附件数量',
+    'Attachment size'          => '附件大小',
+    'Attachment count tips'    => '当前上传的附件数量',
+    'Picture count'            => '图片统计',
+    'Picture nums'             => '图片数量',
+    'Picture size'             => '图片大小',
+    'Server info'              => '服务器信息',
+    'PHP version'              => 'PHP版本',
+    'Sapi name'                => '运行方式',
+    'Debug mode'               => '调试模式',
+    'Software'                 => '环境信息',
+    'Upload mode'              => '上传模式',
+    'Upload url'               => '上传URL',
+    'Upload cdn url'           => '上传CDN',
+    'Cdn url'                  => '静态资源CDN',
+    'Timezone'                 => '时区',
+    'Language'                 => '语言',
+    'View more'                => '查看更多',
 ];

+ 5 - 5
application/admin/view/dashboard/index.html

@@ -194,8 +194,8 @@
                         <div class="sm-st clearfix">
                             <span class="sm-st-icon st-blue"><i class="fa fa-leaf"></i></span>
                             <div class="sm-st-info">
-                                <span>{$totalcategory}</span>
-                                {:__('Total category')}
+                                <span>{$attachmentnums}</span>
+                                {:__('Total attachment')}
                             </div>
                         </div>
                     </div>
@@ -293,14 +293,14 @@
                             <div class="panel-body">
                                 <div class="panel-title">
                                     <span class="label label-primary pull-right">{:__('Real time')}</span>
-                                    <h5>{:__('Category count')}</h5>
+                                    <h5>{:__('Working addon count')}</h5>
                                 </div>
                                 <div class="panel-content">
                                     <div class="row">
                                         <div class="col-md-12">
-                                            <h1 class="no-margins">{$totalcategory}</h1>
+                                            <h1 class="no-margins">{$totalworkingaddon}</h1>
                                             <div class="font-bold"><i class="fa fa-magic"></i>
-                                                <small>{:__('Category count tips')}</small>
+                                                <small>{:__('Working addon count tips')}</small>
                                             </div>
                                         </div>
                                     </div>