Преглед изворни кода

没有库存才能停止预售

shish пре 3 година
родитељ
комит
c9f47707a0
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      app-ghs/controllers/ProductController.php

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

@@ -33,6 +33,9 @@ class ProductController extends BaseController
         $id = $get['id'] ?? 0;
         $info = ProductClass::getById($id, true);
         ProductClass::check($info, $this->mainId);
+        if ($info->stock > 0) {
+            util::fail('没有库存才能停止预售');
+        }
         $info->presell = 0;
         $info->presellDate = '';
         $info->save();