shish 4 лет назад
Родитель
Сommit
99031e3d18
1 измененных файлов с 4 добавлено и 5 удалено
  1. 4 5
      app-ghs/controllers/ProductController.php

+ 4 - 5
app-ghs/controllers/ProductController.php

@@ -323,16 +323,15 @@ class ProductController extends BaseController
             util::fail('请在首店修改');
         }
 
-        $data = Yii::$app->request->post('data', ''); //data = [{id:1,inTurn:10,addPrice:2,cost:10}]
+        $data = Yii::$app->request->post('data', '');
         $type = Yii::$app->request->post('type', '');
         if (empty($data) || empty($type)) {
             util::fail("参数错误");
         }
-        if (in_array($type, ['inTurn', 'addPrice', 'cost', 'weight', 'ratio', 'ratio', 'price', 'stockWarning', 'shelfLife'])) {
-            $data = json_decode($data, true);
-        } else {
-            util::fail('非法操作');
+        if (in_array($type, ['inTurn', 'addPrice', 'qtAddPrice', 'byAddPrice', 'hjAddPrice', 'zsAddPrice', 'cost', 'weight', 'ratio', 'ratio', 'price', 'stockWarning', 'shelfLife']) == false) {
+            util::fail('非法数据修改');
         }
+        $data = json_decode($data, true);
         foreach ($data as $v) {
             if ($type == 'status') {
                 $val = $v[$type] ?? '';