删除冗余代码
This commit is contained in:
parent
6b227688e4
commit
57abdd4fd9
@ -1,51 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catchAdmin\index\controller;
|
namespace catchAdmin\index\controller;
|
||||||
|
|
||||||
use catchAdmin\permissions\model\Permissions;
|
|
||||||
use catchAdmin\user\Auth;
|
|
||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
use catcher\CatchAuth;
|
|
||||||
use catcher\Tree;
|
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
|
|
||||||
class Index extends CatchController
|
class Index extends CatchController
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @time 2019年12月11日
|
|
||||||
* @return string
|
|
||||||
* @throws \think\db\exception\DbException
|
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
|
||||||
*/
|
|
||||||
public function index(): string
|
|
||||||
{
|
|
||||||
$user = (new CatchAuth())->user();
|
|
||||||
|
|
||||||
$permissionIds = $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' => $user->username,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @time 2019年12月11日
|
|
||||||
* @throws \Exception
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function theme(): string
|
|
||||||
{
|
|
||||||
return $this->fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @time 2019年12月12日
|
* @time 2019年12月12日
|
||||||
|
Loading…
x
Reference in New Issue
Block a user