Browse Source

fix db transaction bug

stanley-king 8 years ago
parent
commit
4c44f94d4b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      data/logic/payment.logic.php

+ 2 - 2
data/logic/payment.logic.php

@@ -66,7 +66,6 @@ class paymentLogic
 
 
         try
         try
         {
         {
-            DB::beginTransaction();
             $pd_amount = intval($pd_amount * 100 + 0.5);
             $pd_amount = intval($pd_amount * 100 + 0.5);
             foreach ($order_list as $order_info)
             foreach ($order_list as $order_info)
             {
             {
@@ -98,6 +97,7 @@ class paymentLogic
                     $data_pd['amount'] = floatval($order_pd_amount) / 100;
                     $data_pd['amount'] = floatval($order_pd_amount) / 100;
                     $data_pd['order_sn'] = $order_info['order_sn'];
                     $data_pd['order_sn'] = $order_info['order_sn'];
                     //预存款立即支付,订单支付完成
                     //预存款立即支付,订单支付完成
+                    DB::beginTransaction();
                     $ret = $model_pd->changePd($change_type, $data_pd);
                     $ret = $model_pd->changePd($change_type, $data_pd);
                     if (0 == $ret) {
                     if (0 == $ret) {
                         throw new Exception("订单更新失败");
                         throw new Exception("订单更新失败");
@@ -109,9 +109,9 @@ class paymentLogic
                     if (0 == $ret) {
                     if (0 == $ret) {
                         throw new Exception("订单更新失败");
                         throw new Exception("订单更新失败");
                     }
                     }
+                    DB::commit();
                 }
                 }
             }
             }
-            DB::commit();
             return true;
             return true;
         }
         }
         catch (Exception $e) {
         catch (Exception $e) {