优化控制台统计

pull/382/head
Karson 2022-01-20 16:46:02 +08:00
parent d4531c7df0
commit cd60f5f381
3 changed files with 76 additions and 64 deletions

View File

@ -45,25 +45,34 @@ class Dashboard extends Backend
} }
$dbTableList = Db::query("SHOW TABLE STATUS"); $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([ $this->view->assign([
'totaluser' => User::count(), 'totaluser' => User::count(),
'totaladdon' => count(get_addon_list()), 'totaladdon' => $totaladdon,
'totaladmin' => Admin::count(), 'totaladmin' => Admin::count(),
'totalcategory' => \app\common\model\Category::count(), 'totalcategory' => \app\common\model\Category::count(),
'todayusersignup' => User::whereTime('jointime', 'today')->count(), 'todayusersignup' => User::whereTime('jointime', 'today')->count(),
'todayuserlogin' => User::whereTime('logintime', 'today')->count(), 'todayuserlogin' => User::whereTime('logintime', 'today')->count(),
'sevendau' => User::whereTime('jointime|logintime|prevtime', '-7 days')->count(), 'sevendau' => User::whereTime('jointime|logintime|prevtime', '-7 days')->count(),
'thirtydau' => User::whereTime('jointime|logintime|prevtime', '-30 days')->count(), 'thirtydau' => User::whereTime('jointime|logintime|prevtime', '-30 days')->count(),
'threednu' => User::whereTime('jointime', '-3 days')->count(), 'threednu' => User::whereTime('jointime', '-3 days')->count(),
'sevendnu' => User::whereTime('jointime', '-7 days')->count(), 'sevendnu' => User::whereTime('jointime', '-7 days')->count(),
'dbtablenums' => count($dbTableList), 'dbtablenums' => count($dbTableList),
'dbsize' => array_sum(array_map(function ($item) { 'dbsize' => array_sum(array_map(function ($item) {
return $item['Data_length'] + $item['Index_length']; return $item['Data_length'] + $item['Index_length'];
}, $dbTableList)), }, $dbTableList)),
'attachmentnums' => Attachment::count(), 'totalworkingaddon' => $totalworkingaddon,
'attachmentsize' => Attachment::sum('filesize'), 'attachmentnums' => Attachment::count(),
'picturenums' => Attachment::where('mimetype', 'like', 'image/%')->count(), 'attachmentsize' => Attachment::sum('filesize'),
'picturesize' => Attachment::where('mimetype', 'like', 'image/%')->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('column', array_keys($userlist));

View File

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

View File

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