From 6edcaffa75feaa27da861b10fe25d7830a97c5c7 Mon Sep 17 00:00:00 2001 From: wanger <18037235202@163.com> Date: Thu, 27 May 2021 20:02:25 +0800 Subject: [PATCH 1/3] =?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 927625b77..372fce471 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 f05e5ae72208d3b758a0b95e717a07e794c17fdb Mon Sep 17 00:00:00 2001 From: wanger <18037235202@163.com> Date: Thu, 27 May 2021 20:08:48 +0800 Subject: [PATCH 2/3] =?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 372fce471..b194fa95b 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 e5235a4991445d837ca2fb18e2d4a3af1a941cad Mon Sep 17 00:00:00 2001 From: F4nniu Date: Tue, 15 Jun 2021 23:28:58 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=B0=86=E7=94=A8=E6=88=B7=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E8=A1=A8=E5=8A=A0=E5=85=A5=E5=88=B0=E5=8F=97=E4=BF=9D?= =?UTF-8?q?=E6=8A=A4=E5=88=97=E8=A1=A8=E4=B8=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index b194fa95b..ec84b5ecc 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -23,11 +23,12 @@ class Crud extends Command ]; /** - * 受保护的系统表,crud不会生效 + * 受保护的系统表, crud不会生效 */ - protected $systemTable = [ - 'admin','admin_log','auth_group','auth_group_access','auth_rule', - 'attachment', 'config','category' + protected $systemTables = [ + 'admin', 'admin_log', 'auth_group', 'auth_group_access', 'auth_rule', + 'attachment', 'config', 'category', 'ems', 'sms', + 'user', 'user_group', 'user_rule', 'user_score_log', 'user_token', ]; /** @@ -311,8 +312,8 @@ class Crud extends Command $prefix = Config::get($db . '.prefix'); //系统表无法生成,防止后台错乱 - if(in_array(str_replace($prefix,"",$table),$this->systemTable)){ - throw new Exception('system table name can\'t crud'); + if(in_array(str_replace($prefix,"",$table),$this->systemTables)){ + throw new Exception('system table can\'t be crud'); } //模块 -- Gitee