diff --git a/catch/permissions/controller/Permission.php b/catch/permissions/controller/Permission.php index 343a47d..7a892db 100644 --- a/catch/permissions/controller/Permission.php +++ b/catch/permissions/controller/Permission.php @@ -6,6 +6,7 @@ use catcher\base\CatchRequest as Request; use catcher\base\CatchController; use catcher\CatchResponse; use catcher\exceptions\FailedException; +use catcher\library\ParseClass; use catcher\Tree; use catchAdmin\permissions\model\Permissions; use think\response\Json; @@ -143,6 +144,23 @@ class Permission extends CatchController return CatchResponse::success($permission->save()); } + + /** + * + * @time 2020年06月05日 + * @param $id + * @param ParseClass $parseClass + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @return Json + */ + public function getMethods($id, ParseClass $parseClass) + { + $methods = $parseClass->setModule('catch')->setRule(Permissions::where('id', $id)->find())->onlySelfMethods(); + + return CatchResponse::success($methods); + } } diff --git a/catch/permissions/route.php b/catch/permissions/route.php index ed5c1b4..4004198 100644 --- a/catch/permissions/route.php +++ b/catch/permissions/route.php @@ -6,6 +6,7 @@ $router->get('/role/get/permissions', '\catchAdmin\permissions\controller\Role@g // 权限 $router->resource('permissions', '\catchAdmin\permissions\controller\Permission'); $router->put('permissions/show/', '\catchAdmin\permissions\controller\Permission@show'); +$router->get('controller/methods/', '\catchAdmin\permissions\controller\Permission@getMethods'); // 部门 $router->resource('departments', '\catchAdmin\permissions\controller\Department'); diff --git a/extend/catcher/library/ParseClass.php b/extend/catcher/library/ParseClass.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/extend/catcher/library/ParseClass.php @@ -0,0 +1 @@ +