瀏覽代碼

新增接口 app-hd/item/clear-one-limit-buy

shizhongqi 4 月之前
父節點
當前提交
0282a28f36

+ 24 - 0
app-hd/controllers/ItemController.php

@@ -466,6 +466,30 @@ class ItemController extends BaseController
         util::complete('清除成功');
     }
 
+    //清空单个客户的已购 ssh 20250710
+    public function actionClearOneLimitBuy()
+    {
+        $get = Yii::$app->request->get();
+        $productId = $get['productId'] ?? '';
+        $customId = $get['customId'] ?? 0;
+        $item = ItemClass::getById($productId, true);
+        if (empty($item)) {
+            util::fail('没有找到花材');
+        }
+        if ($item->mainId != $this->mainId) {
+            util::fail('不是你的花材');
+        }
+        $custom = \bizGhs\custom\classes\CustomClass::getById($customId, true);
+        if (empty($custom)) {
+            util::fail('没有客户');
+        }
+        if ($custom->ownMainId != $this->mainId) {
+            util::fail('不是你的客户');
+        }
+        ProductClass::baseClearLimitBuy($productId, $customId);
+        util::complete('清除成功');
+    }
+
     //花材已购客户列表
     public function actionHasLimitBuyCustomList()
     {

+ 0 - 4
biz-hd/purchase/services/PurchaseService.php

@@ -217,10 +217,6 @@ class PurchaseService extends BaseService
                 $orderItemList = OrderItemClass::getOrderItem($orderSn);
                 if (!empty($orderItemList)) {
                     foreach ($orderItemList as $item) {
-                        // if ($item['limitBuy'] <= 0) {
-                            // continue;
-                        // }
-
                         $productId = $item['productId'] ?? 0;
                         $num = floor($item['num'] ?? 0);
                         if (!empty($productId) && $num > 0) {

+ 1 - 1
console/controllers/PurchaseController.php

@@ -50,7 +50,7 @@ class PurchaseController extends Controller
                     PurchaseService::expire($current);
                     $transaction->commit();
 
-                    noticeUtil::push("采购单过期未付款,库存已回滚,单号:{$orderSn}");
+                    //noticeUtil::push("采购单过期未付款,库存已回滚,单号:{$orderSn}");
                 } catch (\Exception $e) {
                     $transaction->rollBack();
                     $msg = $e->getMessage();