This commit is contained in:
walkor 2022-12-13 19:17:03 +08:00
parent da2ff4f09d
commit fe6abf93f4
2 changed files with 21 additions and 21 deletions

View File

@ -685,7 +685,7 @@ EOF;
* @return Layui * @return Layui
* @throws BusinessException * @throws BusinessException
*/ */
static public function buildForm($table, string $type = 'insert'): Layui public static function buildForm($table, string $type = 'insert'): Layui
{ {
if (!in_array($type, ['insert', 'update', 'search'])) { if (!in_array($type, ['insert', 'update', 'search'])) {
$type = 'insert'; $type = 'insert';
@ -746,7 +746,7 @@ EOF;
* @return array|string|string[] * @return array|string|string[]
* @throws BusinessException * @throws BusinessException
*/ */
static public function buildTable($table, int $indent = 0) public static function buildTable($table, int $indent = 0)
{ {
$schema = Util::getSchema($table); $schema = Util::getSchema($table);
$forms = $schema['forms']; $forms = $schema['forms'];

View File

@ -18,7 +18,7 @@ class Util
* @param $algo * @param $algo
* @return false|string|null * @return false|string|null
*/ */
static public function passwordHash($password, $algo = PASSWORD_DEFAULT) public static function passwordHash($password, $algo = PASSWORD_DEFAULT)
{ {
return password_hash($password, $algo); return password_hash($password, $algo);
} }
@ -29,7 +29,7 @@ class Util
* @param $hash * @param $hash
* @return bool * @return bool
*/ */
static public function passwordVerify($password, $hash): bool public static function passwordVerify($password, $hash): bool
{ {
return password_verify($password, $hash); return password_verify($password, $hash);
} }
@ -57,7 +57,7 @@ class Util
* @param $var * @param $var
* @return false|string * @return false|string
*/ */
static public function pdoQuote($var) public static function pdoQuote($var)
{ {
return Util::db()->getPdo()->quote($var, \PDO::PARAM_STR); return Util::db()->getPdo()->quote($var, \PDO::PARAM_STR);
} }
@ -68,7 +68,7 @@ class Util
* @return string * @return string
* @throws BusinessException * @throws BusinessException
*/ */
static public function checkTableName(string $table): string public static function checkTableName(string $table): string
{ {
if (!preg_match('/^[a-zA-Z_0-9]+$/', $table)) { if (!preg_match('/^[a-zA-Z_0-9]+$/', $table)) {
throw new BusinessException('表名不合法'); throw new BusinessException('表名不合法');
@ -82,7 +82,7 @@ class Util
* @return mixed * @return mixed
* @throws BusinessException * @throws BusinessException
*/ */
static public function filterAlphaNum($var) public static function filterAlphaNum($var)
{ {
$vars = (array)$var; $vars = (array)$var;
array_walk_recursive($vars, function ($item) { array_walk_recursive($vars, function ($item) {
@ -99,7 +99,7 @@ class Util
* @return mixed * @return mixed
* @throws BusinessException * @throws BusinessException
*/ */
static public function filterNum($var) public static function filterNum($var)
{ {
$vars = (array)$var; $vars = (array)$var;
array_walk_recursive($vars, function ($item) { array_walk_recursive($vars, function ($item) {
@ -116,7 +116,7 @@ class Util
* @return string * @return string
* @throws BusinessException * @throws BusinessException
*/ */
static public function filterUrlPath($var): string public static function filterUrlPath($var): string
{ {
if (!is_string($var) || !preg_match('/^[a-zA-Z0-9_\-\/&?.]+$/', $var)) { if (!is_string($var) || !preg_match('/^[a-zA-Z0-9_\-\/&?.]+$/', $var)) {
throw new BusinessException('参数不合法'); throw new BusinessException('参数不合法');
@ -130,7 +130,7 @@ class Util
* @return string * @return string
* @throws BusinessException * @throws BusinessException
*/ */
static public function filterPath($var): string public static function filterPath($var): string
{ {
if (!is_string($var) || !preg_match('/^[a-zA-Z0-9_\-\/]+$/', $var)) { if (!is_string($var) || !preg_match('/^[a-zA-Z0-9_\-\/]+$/', $var)) {
throw new BusinessException('参数不合法'); throw new BusinessException('参数不合法');
@ -183,7 +183,7 @@ class Util
* @param string $value * @param string $value
* @return string * @return string
*/ */
static public function camel(string $value): string public static function camel(string $value): string
{ {
static $cache = []; static $cache = [];
$key = $value; $key = $value;
@ -202,7 +202,7 @@ class Util
* @param $value * @param $value
* @return string * @return string
*/ */
static public function smCamel($value): string public static function smCamel($value): string
{ {
return lcfirst(static::camel($value)); return lcfirst(static::camel($value));
} }
@ -212,7 +212,7 @@ class Util
* @param $comment * @param $comment
* @return false|mixed|string * @return false|mixed|string
*/ */
static public function getCommentFirstLine($comment) public static function getCommentFirstLine($comment)
{ {
if ($comment === false) { if ($comment === false) {
return false; return false;
@ -229,7 +229,7 @@ class Util
* 表单类型到插件的映射 * 表单类型到插件的映射
* @return \string[][] * @return \string[][]
*/ */
static public function methodControlMap(): array public static function methodControlMap(): array
{ {
return [ return [
//method=>[控件] //method=>[控件]
@ -273,7 +273,7 @@ class Util
* @param $type * @param $type
* @return string * @return string
*/ */
static public function typeToControl($type): string public static function typeToControl($type): string
{ {
if (stripos($type, 'int') !== false) { if (stripos($type, 'int') !== false) {
return 'inputNumber'; return 'inputNumber';
@ -296,7 +296,7 @@ class Util
* @param $unsigned * @param $unsigned
* @return string * @return string
*/ */
static public function typeToMethod($type, $unsigned = false) public static function typeToMethod($type, $unsigned = false)
{ {
if (stripos($type, 'int') !== false) { if (stripos($type, 'int') !== false) {
$type = str_replace('int', 'Integer', $type); $type = str_replace('int', 'Integer', $type);
@ -319,7 +319,7 @@ class Util
* @return array|mixed * @return array|mixed
* @throws BusinessException * @throws BusinessException
*/ */
static public function getSchema($table, $section = null) public static function getSchema($table, $section = null)
{ {
Util::checkTableName($table); Util::checkTableName($table);
$database = config('database.connections')['plugin.admin.mysql']['database']; $database = config('database.connections')['plugin.admin.mysql']['database'];
@ -395,7 +395,7 @@ class Util
* @param $schema * @param $schema
* @return mixed|string * @return mixed|string
*/ */
static public function getLengthValue($schema) public static function getLengthValue($schema)
{ {
$type = $schema->DATA_TYPE; $type = $schema->DATA_TYPE;
if (in_array($type, ['float', 'decimal', 'double'])) { if (in_array($type, ['float', 'decimal', 'double'])) {
@ -421,7 +421,7 @@ class Util
* @param $control_args * @param $control_args
* @return array * @return array
*/ */
static public function getControlProps($control, $control_args): array public static function getControlProps($control, $control_args): array
{ {
if (!$control_args) { if (!$control_args) {
return []; return [];
@ -461,7 +461,7 @@ class Util
* @param string $package * @param string $package
* @return mixed|string * @return mixed|string
*/ */
static public function getPackageVersion(string $package) public static function getPackageVersion(string $package)
{ {
$installed_php = base_path('vendor/composer/installed.php'); $installed_php = base_path('vendor/composer/installed.php');
if (is_file($installed_php)) { if (is_file($installed_php)) {
@ -475,7 +475,7 @@ class Util
* reload webman (不支持windows) * reload webman (不支持windows)
* @return bool * @return bool
*/ */
static public function reloadWebman() public static function reloadWebman()
{ {
if (function_exists('posix_kill')) { if (function_exists('posix_kill')) {
try { try {