shish 2 лет назад
Родитель
Сommit
348b7bda70
1 измененных файлов с 3 добавлено и 9 удалено
  1. 3 9
      app-ghs/controllers/ProductController.php

+ 3 - 9
app-ghs/controllers/ProductController.php

@@ -36,21 +36,14 @@ class ProductController extends BaseController
         $get = Yii::$app->request->get();
         $id = $get['id'] ?? 0;
         $onStock = $get['onStock'] ?? 0;
-        $info = ProductClass::getById($id, true);
+        $info = ProductClass::getLockById($id);
         ProductClass::check($info, $this->mainId);
-        $info->onStock = $onStock;
-        $info->save();
-
         $oldOnStock = $info->onStock ?? 0;
         $newOnStock = $onStock;
         $num = bcsub($newOnStock, $oldOnStock);
-        echo $num.' |'.$oldOnStock.' ] '.$newOnStock.'-';
         $num = abs($num);
-        echo $num;die;
-
         $staff = $this->shopAdmin;
         $staffName = $staff->name ?? '';
-
         $onRecord = [];
         $onRecord['sjId'] = $this->sjId;
         $onRecord['shopId'] = $this->shopId;
@@ -64,7 +57,8 @@ class ProductController extends BaseController
         $onRecord['newStock'] = $newOnStock;
         $onRecord['ptStyle'] = 2;
         OnStockRecordClass::modify($onRecord);
-
+        $info->onStock = $newOnStock;
+        $info->save();
         util::complete('修改成功');
     }