59 lines
1.4 KiB
PHP
Raw Normal View History

2019-12-02 23:04:43 +08:00
<?php
namespace catchAdmin\index\controller;
2019-12-12 18:52:44 +08:00
use catchAdmin\permissions\model\Permissions;
use catchAdmin\user\Auth;
2019-12-11 21:00:24 +08:00
use catcher\base\CatchController;
2019-12-12 18:52:44 +08:00
use catcher\Tree;
use think\facade\Db;
2019-12-06 08:24:07 +08:00
2019-12-11 21:00:24 +08:00
class Index extends CatchController
2019-12-02 23:04:43 +08:00
{
2019-12-11 21:00:24 +08:00
/**
*
* @time 2019年12月11日
* @return string
2019-12-12 18:52:44 +08:00
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\DataNotFoundException
2019-12-11 21:00:24 +08:00
*/
2019-12-02 23:04:43 +08:00
public function index(): string
{
2019-12-12 18:52:44 +08:00
$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,
]);
2019-12-02 23:04:43 +08:00
}
2019-12-09 16:48:09 +08:00
2019-12-11 21:00:24 +08:00
/**
*
* @time 2019年12月11日
* @throws \Exception
* @return string
*/
public function theme(): string
2019-12-09 16:48:09 +08:00
{
return $this->fetch();
}
2019-12-12 18:52:44 +08:00
/**
*
* @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'],
]);
}
2019-12-02 23:04:43 +08:00
}