wangxiaodong 3 years ago
parent
commit
29a68bfc4b
3 changed files with 10 additions and 10 deletions
  1. 1 1
      addon/wechatpay/model/Pay.php
  2. 8 8
      app/model/order/OrderRefund.php
  3. 1 1
      app/model/system/Pay.php

+ 1 - 1
addon/wechatpay/model/Pay.php

@@ -261,7 +261,7 @@ class Pay extends BaseModel
             //根据微信订单号退款
             // 参数分别为:微信订单号、商户退款单号、订单金额、退款金额、其他参数
             $result = $this->app->refund->byTransactionId($pay_info["trade_no"], $refund_no, $total_fee, $refund_fee, $desc_data);
-            echo "<pre>";print_r($result);exit;
+            //echo "<pre>";print_r($result);exit;
         }else{
             $result = $this->app->refund->byOutTradeNumber($pay_info["out_trade_no"], $refund_no, $total_fee, $refund_fee, $desc_data);
         }

+ 8 - 8
app/model/order/OrderRefund.php

@@ -546,7 +546,7 @@ class OrderRefund extends BaseModel
             return $this->error();
         }
         model('order_goods')->startTrans();
-        //try {
+        try {
 
             $update_data = array(
                 "refund_time" => time(),
@@ -558,7 +558,7 @@ class OrderRefund extends BaseModel
             $res = model('order_goods')->update($update_data, [['order_goods_id', "=", $data['order_goods_id']]]);
 
             $this->finishAction($data['order_goods_id']);
-            echo "<pre>";print_r('111');exit;
+            //echo "<pre>";print_r('111');exit;
             $order_info = model('order')->getInfo(['order_id' => $order_goods_info['order_id']]);
             //调用各种订单
             switch ($order_info['order_type']) {
@@ -585,10 +585,10 @@ class OrderRefund extends BaseModel
 //            event('OrderRefundFinish', $order_goods_info);//传入订单类型以及订单项id
             model('order_goods')->commit();
             return $this->success();
-        /*} catch (\Exception $e) {
+        } catch (\Exception $e) {
             model('order_goods')->rollback();
             return $this->error('', $e->getMessage());
-        }*/
+        }
     }
 
 
@@ -603,7 +603,7 @@ class OrderRefund extends BaseModel
 
 
         model('order_goods')->startTrans();
-        //try {
+        try {
             $order_info = model('order')->getInfo(['order_id' => $order_goods_info['order_id']]);
 
 
@@ -638,7 +638,7 @@ class OrderRefund extends BaseModel
             if($refund_pay_money > 0){
                 $pay_model = new Pay();
                 $refund_result = $pay_model->refund($order_goods_info["refund_no"], $refund_pay_money, $order_info["out_trade_no"], '', $order_info["pay_money"], $order_info["site_id"], 1);
-                echo "<pre>";print_r('2222');exit;
+                //echo "<pre>";print_r('2222');exit;
                 if($refund_result["code"] < 0) {
                     model('order_goods')->rollback();
                     return $refund_result;
@@ -667,10 +667,10 @@ class OrderRefund extends BaseModel
             event('OrderRefundFinish', $order_goods_info);//传入订单类型以及订单项id
             model('order_goods')->commit();
             return $this->success();
-        /*} catch (\Exception $e) {
+        } catch (\Exception $e) {
             model('order_goods')->rollback();
             return $this->error('', $e->getMessage());
-        }*/
+        }
     }
     /**
      * 判断当前订单是否全部退款完毕

+ 1 - 1
app/model/system/Pay.php

@@ -325,7 +325,7 @@ class Pay extends BaseModel
             //退款金额许大于0
             if($refund_fee > 0 && !in_array($pay_info["pay_type"], ["OFFLINE_PAY", "BALANCE", "ONLINE_PAY"])){
                 $result = event("PayRefund", $data, true);
-                echo "<pre>";print_r('333');exit;
+                //echo "<pre>";print_r('333');exit;
                 if(empty($result))
                     return $this->error('', "找不到可用的退款方式!");