$_SERVER['HTTP_HOST'],
'document_root' => $_SERVER['DOCUMENT_ROOT'],
'server_os' => PHP_OS,
'server_port' => $_SERVER['SERVER_PORT'],
'server_ip' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '',
'server_soft' => $_SERVER['SERVER_SOFTWARE'],
'php_version' => PHP_VERSION,
'mysql_version' => $mysqlVersion[0]['ver'],
'max_upload_size' => ini_get('upload_max_filesize'),
'tp_version' => App::version(),
];
View::assign([
'config' => $config,
// 'user' => $user,
// 'message' => $message ?? 0,
// 'messageCatUrl' => $messageCatUrl,
'indexTips' => $this->getIndexTips(),
]);
return View::fetch('index');
}
// 检查提示信息
private function getIndexTips()
{
$user = $this->getSysUser();
$defaultPassword = Config::get('app.default_password') ?: 'admin';
if ($user->password == md5($defaultPassword . $user->salt)) {
return '
请尽快修改后台初始密码!
';
}
return '';
}
public function usedspace()
{
if ($this->request->isAjax()) {
$dirname = $this->app->getRootPath();
$dirsize = get_dir_size($dirname);
return ['code' => 0, 'size' => format_bytes($dirsize)];
}
}
public function clearcache()
{
if ($this->request->isAjax()) {
$runtime_path = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR;
try {
$cache_dir = $runtime_path . 'cache' . DIRECTORY_SEPARATOR;
$admin_dir = $runtime_path . 'admin' . DIRECTORY_SEPARATOR;
$index_dir = $runtime_path . 'index' . DIRECTORY_SEPARATOR;
$api_dir = $runtime_path . 'api' . DIRECTORY_SEPARATOR;
deldir($cache_dir);
deldir($admin_dir);
deldir($index_dir);
deldir($api_dir);
} catch (\Exception $e) {
return ['code' => 0, 'msg' => $e->getMessage()];
}
return ['code' => 1, 'msg' => '清除成功'];
}
}
// 刷新栏目页
// public function reClass($classid)
// {
// $classess = Enewsclass::with('module')->field("classid, bclassid,classname,modid,classpath,islast,islist,listtempid,classurl")->order('classid desc')->select();
// $publicpath = app()->getRootPath() . 'public/';
// foreach ($classess as $key => $class) {
// if ($class->islast == 1) { // 列表模板, 其他的再说
// $model = "\app\common\model\\" . $class->modelName;
// $path = $publicpath . $class->classpath;
// if (!file_exists($path)) {
// mkdir($path, 0755, true);
// }
// $listpage = 25; // 每页25条
// // $total =
// }
// }
// }
}