文件
yjyf/server/application/admin/controller/general/System.php
YuanWen c01e8fc7d9 feat: 新增大量服务类图标及相关接口配置
- 新增20+家电维修类图标(电视、空调、冰箱等)
- 新增短信发送、微信手机号登录接口
- 新增服务规格查询接口
- 更新后台配置与菜单结构
- 移除支付插件相关配置
2026-11-03 11:19:24 +08:00

78 行
2.5 KiB
PHP

<?php
namespace app\admin\controller\general;
use app\common\controller\Backend;
use app\common\model\Attachment;
use think\Db;
/**
* 系统监控与运维概况
*
* @icon fa fa-server
* @remark 用于展示服务器软硬件环境、数据库状态、系统资源占用及开发扩展统计
*/
class System extends Backend
{
public function index()
{
try {
Db::execute("SET @@sql_mode='';");
} catch (\Exception $e) {
}
// 数据库状态
$dbTableList = Db::query("SHOW TABLE STATUS");
$dbsize = array_sum(array_map(function ($item) {
return $item['Data_length'] + $item['Index_length'];
}, $dbTableList));
// 插件统计
$addonList = get_addon_list();
$totalworkingaddon = 0;
$totaladdon = count($addonList);
foreach ($addonList as $item) {
if (!empty($item['state'])) {
$totalworkingaddon += 1;
}
}
// 附件统计
$attachmentnums = Attachment::count();
$attachmentsize = Attachment::sum('filesize');
$picturenums = Attachment::where('mimetype', 'like', 'image/%')->count();
$picturesize = Attachment::where('mimetype', 'like', 'image/%')->sum('filesize');
// 服务器与运行环境信息
$serverInfo = [
'os' => PHP_OS . ' (' . php_uname('r') . ')',
'php_version' => PHP_VERSION,
'sapi' => php_sapi_name(),
'server_soft' => $_SERVER['SERVER_SOFTWARE'] ?? 'Nginx / PHP',
'upload_max' => ini_get('upload_max_filesize'),
'post_max' => ini_get('post_max_size'),
'max_exec_time' => ini_get('max_execution_time') . 's',
'memory_limit' => ini_get('memory_limit'),
'mysql_version' => Db::query("SELECT VERSION() as v")[0]['v'] ?? '5.7',
'server_time' => date('Y-m-d H:i:s'),
'timezone' => date_default_timezone_get(),
];
$this->view->assign([
'dbtablenums' => count($dbTableList),
'dbsize' => $dbsize,
'totaladdon' => $totaladdon,
'totalworkingaddon' => $totalworkingaddon,
'attachmentnums' => $attachmentnums,
'attachmentsize' => $attachmentsize,
'picturenums' => $picturenums,
'picturesize' => $picturesize,
'serverInfo' => $serverInfo,
]);
return $this->view->fetch();
}
}