Merge branch 'develop' of gitee.com:karson/fastadmin into develop

pull/331/MERGE
Karson 2021-07-05 11:47:38 +08:00
commit 4b1c3a3b4b
3 changed files with 22 additions and 3 deletions

View File

@ -21,6 +21,16 @@ 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 $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',
];
/**
* Selectpage搜索字段关联
*/
@ -204,9 +214,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 +311,11 @@ class Crud extends Command
$dbname = Config::get($db . '.database');
$prefix = Config::get($db . '.prefix');
//系统表无法生成,防止后台错乱
if(in_array(str_replace($prefix,"",$table),$this->systemTables)){
throw new Exception('system table can\'t be crud');
}
//模块
$moduleName = 'admin';
$modelModuleName = $local ? $moduleName : 'common';
@ -886,7 +904,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),

View File

@ -473,7 +473,7 @@ class Auth extends \fast\Auth
foreach ($topList as $index => $item) {
$childList = Tree::instance()->getTreeMenu(
$item['id'],
'<li class="@class" pid="@pid"><a @extend href="@url@addtabs" addtabs="@id" class="@menuclass" url="@url" py="@py" pinyin="@pinyin" title="@title"><i class="@icon"></i> <span>@title</span> <span class="pull-right-container">@caret @badge</span></a> @childlist</li>',
'<li class="@class" pid="@pid"><a @extend href="@url@addtabs" addtabs="@id" class="@menuclass" url="@url" py="@py" pinyin="@pinyin"><i class="@icon"></i> <span>@title</span> <span class="pull-right-container">@caret @badge</span></a> @childlist</li>',
$select_id,
'',
'ul',
@ -495,7 +495,7 @@ class Auth extends \fast\Auth
Tree::instance()->init($ruleList);
$menu = Tree::instance()->getTreeMenu(
0,
'<li class="@class"><a @extend href="@url@addtabs" @menutabs class="@menuclass" url="@url" py="@py" pinyin="@pinyin" title="@title"><i class="@icon"></i> <span>@title</span> <span class="pull-right-container">@caret @badge</span></a> @childlist</li>',
'<li class="@class"><a @extend href="@url@addtabs" @menutabs class="@menuclass" url="@url" py="@py" pinyin="@pinyin"><i class="@icon"></i> <span>@title</span> <span class="pull-right-container">@caret @badge</span></a> @childlist</li>',
$select_id,
'',
'ul',

View File

@ -219,6 +219,7 @@ class Email
preg_match_all("/Expected: (\d+)\, Got: (\d+)( \| (.*))?\$/i", $e->getMessage(), $matches);
$code = isset($matches[2][3]) ? $matches[2][3] : 0;
$message = isset($matches[2][0]) ? $matches[4][0] : $e->getMessage();
$message = mb_convert_encoding($message, 'UTF-8', 'GBK,GB2312,BIG5');
$this->setError($message);
} catch (\Exception $e) {
$this->setError($e->getMessage());