shish 5 жил өмнө
parent
commit
b1c75a7e70

+ 7 - 1
app-ghs/controllers/ProductController.php

@@ -233,10 +233,16 @@ class ProductController extends BaseController
                 }
                 }
             }
             }
         }
         }
-
         foreach ($data as $v) {
         foreach ($data as $v) {
             $id = $v['id'];
             $id = $v['id'];
             $val = $v[$type] ?? '';
             $val = $v[$type] ?? '';
+
+            if ($type == 'ratio') {
+                if (preg_match("/^[1-9][0-9]*$/", $val) == false || $val <= 0) {
+                    util::fail('单位比请填写整数,并且要大于0');
+                }
+            }
+
             $where = [];
             $where = [];
             $where['id'] = $id;
             $where['id'] = $id;
             $where['shopId'] = $this->shopId;
             $where['shopId'] = $this->shopId;