Explorar el Código

没有库存才能停止预售

shish hace 3 años
padre
commit
c9f47707a0
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  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;
         $id = $get['id'] ?? 0;
         $info = ProductClass::getById($id, true);
         $info = ProductClass::getById($id, true);
         ProductClass::check($info, $this->mainId);
         ProductClass::check($info, $this->mainId);
+        if ($info->stock > 0) {
+            util::fail('没有库存才能停止预售');
+        }
         $info->presell = 0;
         $info->presell = 0;
         $info->presellDate = '';
         $info->presellDate = '';
         $info->save();
         $info->save();