dever 6 年之前
父节点
当前提交
abb26b8229
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/Database.php

+ 8 - 1
src/Database.php

@@ -2408,7 +2408,11 @@ class Database
 
         if (isset($value['match']) && $value['match'] != 'option') {
             if (is_string($value['match']) && strpos($value['match'], '/') !== false) {
-                $value['valid'] = 'validate[required,custom[' . $key . ']]';
+                if (strstr($value['match'], 'option||')) {
+                    $value['valid'] = 'validate[custom[' . $key . ']]';
+                } else {
+                    $value['valid'] = 'validate[required,custom[' . $key . ']]';
+                }
             } else {
                 $value['valid'] = 'validate[required]';
             }
@@ -3282,6 +3286,9 @@ class Database
 
             foreach ($config['struct'] as $k => $v) {
                 if (isset($v['match']) && $v['match'] != 'option' && is_string($v['match']) && strpos($v['match'], '/') !== false) {
+                    if (strstr($v['match'], 'option||')) {
+                        $v['match'] = str_replace('option||', '', $v['match']);
+                    }
                     $rule[$k]['regex'] = $v['match'];
                     $rule[$k]['alertText'] = $v['desc'];
                 }