mirror of
http://124.126.16.154:8888/singularity/hyperf-admin.git
synced 2026-01-15 06:55:06 +08:00
merge: branch 'master' of github.com:hyperf-admin/hyperf-admin
This commit is contained in:
@@ -332,7 +332,7 @@ class PermissionService
|
||||
return false;
|
||||
}
|
||||
$controllerInstance = container($controller);
|
||||
if (in_array($action, $controllerInstance->open_resources)) {
|
||||
if (isset($controllerInstance->open_resources) && in_array($action, $controllerInstance->open_resources)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,7 @@ class DevController extends AbstractController
|
||||
'number' => 'number',
|
||||
'float' => 'float',
|
||||
'radio' => 'radio',
|
||||
'textarea' => 'textarea',
|
||||
'switch' => 'switch',
|
||||
'date' => 'date',
|
||||
'date_time' => 'date_time',
|
||||
@@ -142,6 +143,12 @@ class DevController extends AbstractController
|
||||
'datetime_range' => 'datetime_range',
|
||||
'image' => 'image',
|
||||
'file' => 'file',
|
||||
'html' => 'html',
|
||||
'icon-select' => 'icon-select',
|
||||
'sub-form' => 'sub-form',
|
||||
'inputRange' => 'inputRange',
|
||||
'cascader' => 'cascader',
|
||||
'json' => 'json',
|
||||
],
|
||||
'default' => 'input',
|
||||
'col' => [
|
||||
@@ -289,13 +296,13 @@ class DevController extends AbstractController
|
||||
$ret = [];
|
||||
$ignores = ['id', 'create_at', 'update_at', 'is_deleted'];
|
||||
foreach ($schema as $item) {
|
||||
if (in_array($item['column_name'], $ignores)) {
|
||||
if (in_array($item['COLUMN_NAME'], $ignores)) {
|
||||
continue;
|
||||
}
|
||||
$ret[] = [
|
||||
'field' => $item['column_name'],
|
||||
'label' => $item['column_comment'],
|
||||
'type' => $this->transType($item['data_type']),
|
||||
'field' => $item['COLUMN_NAME'],
|
||||
'label' => $item['COLUMN_COMMENT'],
|
||||
'type' => $this->transType($item['DATA_TYPE']),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -309,6 +316,10 @@ class DevController extends AbstractController
|
||||
return 'datetime';
|
||||
case 'bigint':
|
||||
return 'number';
|
||||
case 'text':
|
||||
return 'html';
|
||||
case 'enum':
|
||||
return 'radio';
|
||||
default:
|
||||
return 'input';
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class ModelMaker extends AbstractMaker
|
||||
return false;
|
||||
}
|
||||
$columns = array_values(array_filter(array_map(function ($item) {
|
||||
if(in_array($item['column_name'], [
|
||||
if(in_array($item['COLUMN_NAME'], [
|
||||
'create_at',
|
||||
'update_at',
|
||||
'is_deleted',
|
||||
@@ -30,7 +30,7 @@ class ModelMaker extends AbstractMaker
|
||||
return null;
|
||||
}
|
||||
|
||||
return $item['column_name'];
|
||||
return $item['COLUMN_NAME'];
|
||||
}, $schema)));
|
||||
$class_namespace = $this->pathToNamespace($path) . '\\' . Str::studly($database);
|
||||
$class_name = Str::studly($table);
|
||||
@@ -68,10 +68,10 @@ class ModelMaker extends AbstractMaker
|
||||
|
||||
protected function getProperty($column): array
|
||||
{
|
||||
$name = $column['column_name'];
|
||||
$type = $this->formatPropertyType($column['data_type'], $column['cast'] ?? null);
|
||||
$name = $column['COLUMN_NAME'];
|
||||
$type = $this->formatPropertyType($column['DATA_TYPE'], $column['cast'] ?? null);
|
||||
|
||||
return [$name, $type, $column['column_comment']];
|
||||
return [$name, $type, $column['COLUMN_COMMENT']];
|
||||
}
|
||||
|
||||
protected function formatDatabaseType(string $type): ?string
|
||||
|
||||
@@ -25,7 +25,7 @@ class TableSchema
|
||||
$builder = $this->getSchemaBuilder($pool);
|
||||
|
||||
return $builder->getConnection()
|
||||
->select('select `column_name`, `data_type`, `column_comment` from information_schema.columns where `table_schema` = ? and `table_name` = ? order by ORDINAL_POSITION', [
|
||||
->select('select `COLUMN_NAME`, `DATA_TYPE`, `COLUMN_COMMENT` from information_schema.COLUMNS where `TABLE_SCHEMA` = ? and `TABLE_NAME` = ? order by ORDINAL_POSITION', [
|
||||
$database,
|
||||
$table_name,
|
||||
]);
|
||||
@@ -48,11 +48,11 @@ class TableSchema
|
||||
{
|
||||
$builder = $this->getSchemaBuilder($pool);
|
||||
$ret = $builder->getConnection()
|
||||
->select("select table_name from information_schema.tables where table_schema=? and table_type='base table';", [
|
||||
->select("select TABLE_NAME from information_schema.tables where table_schema=? and table_type='BASE TABLE';", [
|
||||
$database,
|
||||
]);
|
||||
|
||||
return array_column($ret ?? [], 'table_name');
|
||||
return array_column($ret ?? [], 'TABLE_NAME');
|
||||
}
|
||||
|
||||
public function tableDesign($pool, $database, $table_name)
|
||||
|
||||
Reference in New Issue
Block a user