rabin 1 年間 前
コミット
cbe44074e9
1 ファイル変更44 行追加2 行削除
  1. 44 2
      src/Database.php

+ 44 - 2
src/Database.php

@@ -545,6 +545,20 @@ class Database
             }
         }
 
+        $search = Dever::preInput('set_');
+        if ($search) {
+            $this->info['mul'] .= '&' . http_build_query($search);
+
+            if (layadmin()) {
+                foreach ($search as $k => $v) {
+                    if (is_array($v)) {
+                        $v = implode(',', $v);
+                    }
+                    $this->info['search_param'] .= '<input type="hidden" name="'.$k.'"  value="'.$v.'"/>';
+                }
+            }
+        }
+
         if ($this->id) {
             $this->info['update_header'] = $menu . '-更新数据' . $this->refer('list');
         }
@@ -2512,6 +2526,14 @@ class Database
                 unset($search[$k]);
             }
         }
+        $set = Dever::preInput('set_');
+        if ($set) {
+            foreach ($set as $k => $v) {
+                $v = ltrim(rtrim($v));
+                $k = str_replace('set_', '', $k);
+                $param[$k] = $v;
+            }
+        }
         foreach ($search as $k => $v) {
             if ($v) {
                 if (is_string($v)) {
@@ -4786,8 +4808,28 @@ class Database
                             $t = explode('-', $v1);
                             $v1 = $t[0] . '/' . $t[1];
                         }
-                        if (isset($config['struct'][$v1]) && !isset($update_id[$k][$v1])) {
-                            Dever::alert($config['struct'][$v1]['name'] . '不能为空');
+                        if (isset($config['struct'][$v1])) {
+                            if (strstr($v1, '/') && !isset($update_id[$k][$v1])) {
+                                Dever::alert($config['struct'][$v1]['name'] . '不能为空');
+                            } elseif (!isset($v[$v1])) {
+                                Dever::alert($config['struct'][$v1]['name'] . '不能为空');
+                            }
+                        }
+                    }
+                }
+                if (!$fast && $method == 'update' && isset($config['manage']['update_check'])) {
+                    $update_check = explode(',', $config['manage']['update_check']);
+                    foreach ($update_check as $k1 => $v1) {
+                        if (strstr($v1, '-')) {
+                            $t = explode('-', $v1);
+                            $v1 = $t[0] . '/' . $t[1];
+                        }
+                        if (isset($config['struct'][$v1])) {
+                            if (strstr($v1, '/') && !isset($update_id[$k][$v1])) {
+                                Dever::alert($config['struct'][$v1]['name'] . '不能为空');
+                            } elseif (!isset($v[$v1])) {
+                                Dever::alert($config['struct'][$v1]['name'] . '不能为空');
+                            }
                         }
                     }
                 }