From f9ed43017ffba105ad9957f398eb583698a455aa Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Fri, 5 Jun 2020 15:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9D=83=E9=99=90=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/permissions/controller/Permission.php | 18 ++++++++++++++++++ catch/permissions/route.php | 1 + extend/catcher/library/ParseClass.php | 1 + 3 files changed, 20 insertions(+) create mode 100644 extend/catcher/library/ParseClass.php 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 @@ +