改名
This commit is contained in:
+14
-11
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Gii;
|
namespace Gii;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use ReflectionException;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,6 +19,12 @@ class GiiController extends GiiBase
|
|||||||
|
|
||||||
public array $fields = [];
|
public array $fields = [];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GiiController constructor.
|
||||||
|
* @param $className
|
||||||
|
* @param $fields
|
||||||
|
*/
|
||||||
public function __construct($className, $fields)
|
public function __construct($className, $fields)
|
||||||
{
|
{
|
||||||
$this->className = $className;
|
$this->className = $className;
|
||||||
@@ -27,7 +34,8 @@ class GiiController extends GiiBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string|bool
|
* @return string|bool
|
||||||
* @throws \ReflectionException
|
* @throws ReflectionException
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function generate(): string|bool
|
public function generate(): string|bool
|
||||||
{
|
{
|
||||||
@@ -375,16 +383,11 @@ use {$model_namespace}\\{$managerName};
|
|||||||
$_field['type'] = $_key;
|
$_field['type'] = $_key;
|
||||||
|
|
||||||
if ($type == 'date' || $type == 'datetime' || $type == 'time') {
|
if ($type == 'date' || $type == 'datetime' || $type == 'time') {
|
||||||
switch ($type) {
|
$_tps = match ($type) {
|
||||||
case 'date':
|
'date' => '$this->input->' . $_key . '(\'' . $val['Field'] . '\', date(\'Y-m-d\'))',
|
||||||
$_tps = '$this->input->' . $_key . '(\'' . $val['Field'] . '\', date(\'Y-m-d\'))';
|
'time' => '$this->input->' . $_key . '(\'' . $val['Field'] . '\', date(\'H:i:s\'))',
|
||||||
break;
|
default => '$this->input->' . $_key . '(\'' . $val['Field'] . '\', date(\'Y-m-d H:i:s\'))',
|
||||||
case 'time':
|
};
|
||||||
$_tps = '$this->input->' . $_key . '(\'' . $val['Field'] . '\', date(\'H:i:s\'))';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$_tps = '$this->input->' . $_key . '(\'' . $val['Field'] . '\', date(\'Y-m-d H:i:s\'))';
|
|
||||||
}
|
|
||||||
$html .= '
|
$html .= '
|
||||||
\'' . str_pad($val['Field'] . '\'', $length, ' ', STR_PAD_RIGHT) . ' => ' . str_pad($_tps . ',', 60, ' ', STR_PAD_RIGHT) . $comment;
|
\'' . str_pad($val['Field'] . '\'', $length, ' ', STR_PAD_RIGHT) . ' => ' . str_pad($_tps . ',', 60, ' ', STR_PAD_RIGHT) . $comment;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user