浏览代码

fix db transaction bug

stanley-king 8 年之前
父节点
当前提交
4c44f94d4b
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      data/logic/payment.logic.php

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

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