From 8e0698ea1f0383dffc61b6d60d5dc7ae38132d87 Mon Sep 17 00:00:00 2001 From: wanger <18037235202@163.com> Date: Tue, 25 May 2021 17:10:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcrud=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=97=B6=E6=9C=AA=E9=80=89=E4=B8=ADid?= =?UTF-8?q?=E4=B8=BB=E9=94=AE=E6=97=B6=E5=AF=BC=E8=87=B4=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index 927625b77..d407c6284 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -881,7 +881,7 @@ class Crud extends Command 'recyclebinJs' => '', 'headingHtml' => $headingHtml, 'recyclebinHtml' => $recyclebinHtml, - 'visibleFieldList' => $fields ? "\$row->visible(['" . implode("','", array_filter(explode(',', $fields))) . "']);" : '', + 'visibleFieldList' => $fields ? "\$row->visible(['" . implode("','", array_filter(in_array($priKey,explode(',', $fields))?explode(',', $fields):explode(',',$priKey.','.$fields))) . "']);" : '', 'appendAttrList' => implode(",\n", $appendAttrList), 'getEnumList' => implode("\n\n", $getEnumArr), 'getAttrList' => implode("\n\n", $getAttrArr), -- Gitee From 0fd1e843e3687e04af92d58856de7d11a36f8463 Mon Sep 17 00:00:00 2001 From: wanger <18037235202@163.com> Date: Thu, 27 May 2021 20:02:25 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E8=A1=A8=E6=96=87=E4=BB=B6=E7=94=9F=E6=88=90=E8=A2=AB=E8=A6=86?= =?UTF-8?q?=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index d407c6284..2f02a1b87 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -21,6 +21,14 @@ class Crud extends Command protected $internalKeywords = [ 'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', 'extends', 'final', 'for', 'foreach', 'function', 'global', 'goto', 'if', 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', 'require', 'require_once', 'return', 'static', 'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor' ]; + + /** + * 受保护的系统表,crud不会生效 + */ + protected $systemTable = [ + 'admin', 'attachment', 'auth_group', 'auth_group_access', 'auth_rule', 'category', 'config' + ]; + /** * Selectpage搜索字段关联 */ @@ -204,9 +212,12 @@ class Crud extends Command $force = $input->getOption('force'); //是否为本地model,为0时表示为全局model将会把model放在app/common/model中 $local = $input->getOption('local'); + if (!$table) { throw new Exception('table name can\'t empty'); } + + //是否生成菜单 $menu = $input->getOption("menu"); //关联表 @@ -298,6 +309,11 @@ class Crud extends Command $dbname = Config::get($db . '.database'); $prefix = Config::get($db . '.prefix'); + //系统表无法生成,防止后台错乱 + if(in_array(str_replace($prefix,"",$table),$this->systemTable)){ + throw new Exception('system table name can\'t crud'); + } + //模块 $moduleName = 'admin'; $modelModuleName = $local ? $moduleName : 'common'; -- Gitee From 43114a1e646571b8c429b168db1b2dfe434fec9b Mon Sep 17 00:00:00 2001 From: wanger <18037235202@163.com> Date: Thu, 27 May 2021 20:08:48 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0admin=5Flog=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index 2f02a1b87..c3286beb8 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -26,7 +26,8 @@ class Crud extends Command * 受保护的系统表,crud不会生效 */ protected $systemTable = [ - 'admin', 'attachment', 'auth_group', 'auth_group_access', 'auth_rule', 'category', 'config' + 'admin','admin_log','auth_group','auth_group_access','auth_rule', + 'attachment', 'config','category' ]; /** @@ -313,7 +314,7 @@ class Crud extends Command if(in_array(str_replace($prefix,"",$table),$this->systemTable)){ throw new Exception('system table name can\'t crud'); } - + //模块 $moduleName = 'admin'; $modelModuleName = $local ? $moduleName : 'common'; -- Gitee From 3bf6f3b26d5e73cac18246c8314e445a2acaaea1 Mon Sep 17 00:00:00 2001 From: wanger <18037235202@163.com> Date: Fri, 28 May 2021 10:18:46 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index c3286beb8..a78200d91 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -26,8 +26,7 @@ class Crud extends Command * 受保护的系统表,crud不会生效 */ protected $systemTable = [ - 'admin','admin_log','auth_group','auth_group_access','auth_rule', - 'attachment', 'config','category' + 'admin','admin_log','auth_group','auth_group_access','auth_rule', 'attachment', 'config','category' ]; /** -- Gitee