ソースを参照

修改添加积分异常

llp 5 日 前
コミット
70d893645b

+ 3 - 3
packages/Longyi/RewardPoints/src/Repositories/RewardPointRepository.php

@@ -214,7 +214,7 @@ class RewardPointRepository extends Repository
 
 
                 if (!$customerPoints) {
                 if (!$customerPoints) {
                     Log::warning('Customer points record not found', ['customer_id' => $customerId]);
                     Log::warning('Customer points record not found', ['customer_id' => $customerId]);
-                    return false;
+                    throw new \Exception('Customer points record not found');
                 }
                 }
 
 
                 if ($customerPoints->mw_reward_point < $amount) {
                 if ($customerPoints->mw_reward_point < $amount) {
@@ -223,7 +223,7 @@ class RewardPointRepository extends Repository
                         'current' => $customerPoints->mw_reward_point,
                         'current' => $customerPoints->mw_reward_point,
                         'required' => $amount
                         'required' => $amount
                     ]);
                     ]);
-                    return false;
+                    throw new \Exception('Insufficient points');
                 }
                 }
 
 
                 $currentBalance = (int) $customerPoints->mw_reward_point;
                 $currentBalance = (int) $customerPoints->mw_reward_point;
@@ -264,7 +264,7 @@ class RewardPointRepository extends Repository
                 'amount' => $amount,
                 'amount' => $amount,
                 'error' => $e->getMessage()
                 'error' => $e->getMessage()
             ]);
             ]);
-            return false;
+            throw $e;
         }
         }
     }
     }
     public function getHistory($customerId, $limit = 20, $page = null)
     public function getHistory($customerId, $limit = 20, $page = null)