From 3a522c5999638cabdedb942b0e6525adc24123b5 Mon Sep 17 00:00:00 2001 From: walkor Date: Tue, 6 Dec 2022 14:30:26 +0800 Subject: [PATCH] save --- src/plugin/admin/app/controller/AdminRuleController.php | 8 ++++---- src/plugin/admin/app/controller/TableController.php | 8 +++++--- src/plugin/admin/public/admin/js/common.js | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/plugin/admin/app/controller/AdminRuleController.php b/src/plugin/admin/app/controller/AdminRuleController.php index 5e91dd4..f43fbdb 100644 --- a/src/plugin/admin/app/controller/AdminRuleController.php +++ b/src/plugin/admin/app/controller/AdminRuleController.php @@ -106,15 +106,15 @@ class AdminRuleController extends Crud */ public function permission(Request $request): Response { - $controller = $request->get('controller'); - if (!$controller) { - return $this->json(0, 'ok', []); - } $rules = $this->getRules(admin('roles')); // 超级管理员 if (in_array('*', $rules)) { return $this->json(0, 'ok', ['*']); } + $controller = $request->get('controller'); + if (!$controller) { + return $this->json(0, 'ok', []); + } // 获取详细权限 $controller_search = str_replace('\\', '\\\\', $controller); $keys = AdminRule::where('key', 'like', "$controller_search%") diff --git a/src/plugin/admin/app/controller/TableController.php b/src/plugin/admin/app/controller/TableController.php index a93027e..2a3fefb 100644 --- a/src/plugin/admin/app/controller/TableController.php +++ b/src/plugin/admin/app/controller/TableController.php @@ -485,7 +485,7 @@ class TableController extends Base $template_file_path = "$controller_path_base/app/view/$template_path"; $model_class_with_namespace = "$model_namespace\\$model_class"; $primary_key = (new $model_class_with_namespace)->getKeyName(); - $this->createTemplate($template_file_path, $table_name, $template_path, $url_path_base, $primary_key); + $this->createTemplate($template_file_path, $table_name, $template_path, $url_path_base, $primary_key, "$controller_namespace\\$controller_class"); $reflection = new \ReflectionClass("$controller_namespace\\$controller_class"); $controller_class_with_nsp = $reflection->getName(); @@ -696,9 +696,10 @@ EOF; * @param $template_path * @param $url_path_base * @param $primary_key + * @param $controller_class_with_namespace * @return void */ - protected function createTemplate($template_file_path, $table, $template_path, $url_path_base, $primary_key) + protected function createTemplate($template_file_path, $table, $template_path, $url_path_base, $primary_key, $controller_class_with_namespace) { $this->mkdir($template_file_path . '/index.html'); $form = LayuiForm::buildForm($table, 'search'); @@ -772,8 +773,9 @@ EOF