Przeglądaj źródła

crud自动生成字段默认值判断

Signed-off-by: Jon <363516862@qq.com>
Jon 2 lat temu
rodzic
commit
cecf1ad1cd
1 zmienionych plików z 5 dodań i 0 usunięć
  1. 5 0
      application/admin/command/Crud.php

+ 5 - 0
application/admin/command/Crud.php

@@ -957,6 +957,11 @@ class Crud extends Command
                             $attrArr['size'] = 50;
                         }
 
+                        //字段默认值判断
+                        if ('NULL' == $defaultValue || "''" == $defaultValue) {
+                            $defaultValue = '';
+                        }
+
                         $formAddElement = Form::input($inputType, $fieldName, $defaultValue, $attrArr);
                         $formEditElement = Form::input($inputType, $fieldName, $editValue, $attrArr);
                         if ($search && $replace) {