Просмотр исходного кода

没有库存才能停止预售

shish 3 лет назад
Родитель
Сommit
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();