bianjunhui 3 днів тому
батько
коміт
8656d76c3b

+ 9 - 8
packages/Longyi/RewardPoints/src/Listeners/OrderEvents.php

@@ -124,14 +124,15 @@ class OrderEvents
         }
 
         DB::transaction(function () use ($order) {
-            $histories = $this->rewardPointRepository->findWhere([
-                'customer_id' => $order->customer_id,
-                'history_order_id' => $order->id,
-                'type_of_transaction' => RewardActiveRule::TYPE_ORDER
-            ])->whereIn('status', [
-                RewardPointHistory::STATUS_PENDING,
-                RewardPointHistory::STATUS_COMPLETED
-            ])->get();
+            $histories = RewardPointHistory::query()
+                ->where('customer_id', $order->customer_id)
+                ->where('history_order_id', $order->id)
+                ->where('type_of_transaction', RewardActiveRule::TYPE_ORDER)
+                ->whereIn('status', [
+                    RewardPointHistory::STATUS_PENDING,
+                    RewardPointHistory::STATUS_COMPLETED
+                ])
+                ->get();
 
             foreach ($histories as $history) {
                 $this->processCancellationHistory($history, $order);