rabin 3 hari lalu
induk
melakukan
1f3da69a99
2 mengubah file dengan 18 tambahan dan 0 penghapusan
  1. 15 0
      src/dai/seller/app/Lib/Channel.php
  2. 3 0
      src/dai/seller/app/Lib/Order.php

+ 15 - 0
src/dai/seller/app/Lib/Channel.php

@@ -34,6 +34,21 @@ class Channel
         return [$channelId, $channelGoodsId, $discount];
     }
 
+    /**
+     * 订单被人工处理时,移除渠道队列里的遗留任务
+     */
+    public function removeQueuedOrder($channelId, $orderId): void
+    {
+        $channelId = (int)$channelId;
+        $orderId = (int)$orderId;
+        if ($channelId <= 0 || $orderId <= 0) {
+            return;
+        }
+
+        $queueKey = "channel_queue:$channelId";
+        Redis::connect()->lRem($queueKey, $orderId, 0);
+    }
+
 
     /**
      * =====================================

+ 3 - 0
src/dai/seller/app/Lib/Order.php

@@ -92,6 +92,9 @@ class Order
             $order['status'] = $update['status'] = $status;
             $update['finish'] = 1;
             $update['finish_date'] = time();
+            if (!empty($order['channel_id'])) {
+                Dever::load(Channel::class)->removeQueuedOrder($order['channel_id'], $order['id']);
+            }
             $order = array_merge($order, $update);
             $this->finish($order, $choose, $table);
         }