增加默认错误页面

This commit is contained in:
wuyanwen
2019-12-12 18:52:44 +08:00
parent 5c7c976869
commit a0a62b5640
5 changed files with 266 additions and 165 deletions

View File

@@ -1,19 +1,35 @@
<?php
namespace catchAdmin\index\controller;
use catchAdmin\permissions\model\Permissions;
use catchAdmin\user\Auth;
use catcher\base\CatchController;
use catcher\Tree;
use think\facade\Db;
class Index extends CatchController
{
/**
*
* @time 2019年12月11日
* @throws \Exception
* @return string
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\DataNotFoundException
*/
public function index(): string
{
return $this->fetch();
$permissionIds = Auth::user()->getPermissionsBy();
$menus = Permissions::whereIn('id', $permissionIds)
->where('type', Permissions::MENU_TYPE)
->field(['id', 'parent_id', 'permission_name', 'route'])
->select()->toArray();
return $this->fetch([
'menus' => Tree::done($menus),
'username' => Auth::user()->username,
]);
}
/**
@@ -26,4 +42,18 @@ class Index extends CatchController
{
return $this->fetch();
}
/**
*
* @time 2019年12月12日
* @throws \Exception
* @return string
*/
public function dashboard(): string
{
$mysqlVersion = Db::query('select version() as version');
return $this->fetch([
'mysql_version' => $mysqlVersion['0']['version'],
]);
}
}