From 98e15deeac90f6219e08f19091e14f61df12207a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9D=BE=E6=A0=91?= Date: Fri, 18 Dec 2020 12:10:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 8 +++++ app/index/controller/Index.php | 62 +++++++++++++++++++++++++++++++++- app/system/common.php | 6 +--- database/seeds/Rule.php | 56 ++++++++++++++++++++++++++++-- public/.gitignore | 1 + public/.user.ini | 1 + 6 files changed, 125 insertions(+), 9 deletions(-) create mode 100644 public/.gitignore create mode 100644 public/.user.ini diff --git a/app/common.php b/app/common.php index bbda1e12..e89490c6 100644 --- a/app/common.php +++ b/app/common.php @@ -188,3 +188,11 @@ $check = $md5->check($inputPassword, $serverPassword); return $check; } + + + // 文件大小 + function format_bytes($size, $delimiter = '') { + $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB'); + for ($i = 0; $size >= 1024 && $i < 5; $i++) $size /= 1024; + return round($size, 2) . $delimiter . $units[$i]; + } diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 0de823fb..0dc10865 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -64,7 +64,12 @@ class Index extends AdminBase // 获取服务器操作系统 $list->xitong = php_uname('s'); // 获取磁盘空间 - $list->kongjian = round(disk_free_space('/')*1/1024/1024/1024, 2).'GB'; + if ($list->xitong == 'Linux') { + $list->kongjian = disk_free_space('.'); + } else { + $list->kongjian = rdisk_free_space('/'); + } + $list->kongjian = format_bytes($list->kongjian); // 获取Session过期时间 $list->session = \think\facade\Config::get('session.expire').'s'; // 获取thinkphp版本 @@ -102,5 +107,60 @@ class Index extends AdminBase // 渲染输出 return $view->fetch('welcome'); + } + + + // 获取操作系统 + private function getOS(){ + $os=''; + $Agent=$_SERVER['HTTP_USER_AGENT']; + if (eregi('win',$Agent)&&strpos($Agent, '95')){ + $os='Windows 95'; + }elseif(eregi('win 9x',$Agent)&&strpos($Agent, '4.90')){ + $os='Windows ME'; + }elseif(eregi('win',$Agent)&&ereg('98',$Agent)){ + $os='Windows 98'; + }elseif(eregi('win',$Agent)&&eregi('nt 5.0',$Agent)){ + $os='Windows 2000'; + }elseif(eregi('win',$Agent)&&eregi('nt 6.0',$Agent)){ + $os='Windows Vista'; + }elseif(eregi('win',$Agent)&&eregi('nt 6.1',$Agent)){ + $os='Windows 7'; + }elseif(eregi('win',$Agent)&&eregi('nt 5.1',$Agent)){ + $os='Windows XP'; + }elseif(eregi('win',$Agent)&&eregi('nt',$Agent)){ + $os='Windows NT'; + }elseif(eregi('win',$Agent)&&ereg('32',$Agent)){ + $os='Windows 32'; + }elseif(eregi('linux',$Agent)){ + $os='Linux'; + }elseif(eregi('unix',$Agent)){ + $os='Unix'; + }else if(eregi('sun',$Agent)&&eregi('os',$Agent)){ + $os='SunOS'; + }elseif(eregi('ibm',$Agent)&&eregi('os',$Agent)){ + $os='IBM OS/2'; + }elseif(eregi('Mac',$Agent)&&eregi('PC',$Agent)){ + $os='Macintosh'; + }elseif(eregi('PowerPC',$Agent)){ + $os='PowerPC'; + }elseif(eregi('AIX',$Agent)){ + $os='AIX'; + }elseif(eregi('HPUX',$Agent)){ + $os='HPUX'; + }elseif(eregi('NetBSD',$Agent)){ + $os='NetBSD'; + }elseif(eregi('BSD',$Agent)){ + $os='BSD'; + }elseif(ereg('OSF1',$Agent)){ + $os='OSF1'; + }elseif(ereg('IRIX',$Agent)){ + $os='IRIX'; + }elseif(eregi('FreeBSD',$Agent)){ + $os='FreeBSD'; + }elseif($os==''){ + $os='Unknown'; + } + return $os; } } diff --git a/app/system/common.php b/app/system/common.php index 11abe8dc..e915398a 100644 --- a/app/system/common.php +++ b/app/system/common.php @@ -1,8 +1,4 @@ = 1024 && $i < 5; $i++) $size /= 1024; - return round($size, 2) . $delimiter . $units[$i]; -} + diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index db020acf..0563fd25 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -1168,7 +1168,7 @@ class Rule extends Seeder ['id' => 703 ,'title' => '文件管理' ,'name' => 'system/fields/index' - ,'paixu' => 2 + ,'paixu' => 3 ,'ismenu' => 1 ,'pid' => 7 ,'url' => '/system/file' @@ -1188,7 +1188,7 @@ class Rule extends Seeder ['id' => 704 ,'title' => '数据备份' ,'name' => 'system/backup/index' - ,'paixu' => 4 + ,'paixu' => 5 ,'ismenu' => 1 ,'pid' => 7 ,'url' => '/system/backup/index' @@ -1221,7 +1221,7 @@ class Rule extends Seeder ['id' => 705 ,'title' => '系统设置' ,'name' => 'system/systembase/edit' - ,'paixu' => 5 + ,'paixu' => 6 ,'ismenu' => 1 ,'pid' => 7 ,'url' => '/system/' @@ -1232,6 +1232,56 @@ class Rule extends Seeder ,'paixu' => 1 ,'pid' => 705 ], + ['id' => 706 + ,'title' => '统计项目' + ,'name' => 'kaoshi/tongjixiangmu/index' + ,'paixu' => 4 + ,'ismenu' => 1 + ,'pid' => 7 + ,'url' => '/kaoshi/tjxm/index' + ], + ['id' => 70601 + ,'title' => '添加' + ,'name' => 'kaoshi/tongjixiangmu/create' + ,'paixu' => 1 + ,'pid' => 706 + ], + ['id' => 70602 + ,'title' => '保存' + ,'name' => 'kaoshi/tongjixiangmu/save' + ,'paixu' => 2 + ,'pid' => 706 + ], + ['id' => 70603 + ,'title' => '编辑' + ,'name' => 'kaoshi/tongjixiangmu/edit' + ,'paixu' => 3 + ,'pid' => 706 + ], + ['id' => 70604 + ,'title' => '更新' + ,'name' => 'kaoshi/tongjixiangmu/update' + ,'paixu' => 4 + ,'pid' => 706 + ], + ['id' => 70605 + ,'title' => '参与统计' + ,'name' => 'kaoshi/tongjixiangmu/tongji' + ,'paixu' => 5 + ,'pid' => 706 + ], + ['id' => 70606 + ,'title' => '添加' + ,'name' => 'kaoshi/tongjixiangmu/setstatus' + ,'paixu' => 6 + ,'pid' => 706 + ], + ['id' => 70607 + ,'title' => 'shanchu' + ,'name' => 'kaoshi/tongjixiangmu/delete' + ,'paixu' => 7 + ,'pid' => 706 + ], /*====================================================================== * 考试管理 diff --git a/public/.gitignore b/public/.gitignore new file mode 100644 index 00000000..c36bc637 --- /dev/null +++ b/public/.gitignore @@ -0,0 +1 @@ +.user.ini \ No newline at end of file diff --git a/public/.user.ini b/public/.user.ini new file mode 100644 index 00000000..bdf66aea --- /dev/null +++ b/public/.user.ini @@ -0,0 +1 @@ +open_basedir=/www/wwwroot/x.cj.cn/:/tmp/ \ No newline at end of file