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