shish 1 年之前
父节点
当前提交
aea5d5596a
共有 1 个文件被更改,包括 1 次插入6 次删除
  1. 1 6
      app-hd/controllers/PurchaseController.php

+ 1 - 6
app-hd/controllers/PurchaseController.php

@@ -330,6 +330,7 @@ class PurchaseController extends BaseController
                     if ($version >= 10) {
                         $stock = $currentInfo['stock'] ?? 0;
                         $stock = floatval($stock);
+                        $stock = intval($stock);
                         $productId = $currentInfo['id'] ?? 0;
                         $productName = $currentInfo['name'] ?? '';
                         $num = $orderNum[$productId] && $orderNum[$productId]['num'] ? $orderNum[$productId]['num'] : 0;
@@ -355,14 +356,8 @@ class PurchaseController extends BaseController
                         $allNoStock = true;
                         foreach ($productList as $pKey => $pVal) {
                             $productId = $pVal['productId'] ?? 0;
-                            $productName = $pVal['name'] ?? '';
                             if (isset($changeList[$productId])) {
-                                //解决剩下0.5扎和2.5扎,出现的异常情况
                                 $changeStock = $changeList[$productId];
-                                $changeStock = intval($changeStock);
-                                if ($changeStock < 1) {
-                                    util::fail($productName . '不足1扎,不能下单');
-                                }
                                 $productList[$pKey]['bigNum'] = $changeStock;
                             }
                             if ($productList[$pKey]['bigNum'] > 0) {