Browse Source

采购支付回调 id

shish 5 years ago
parent
commit
68c035b65d

+ 2 - 1
app-hd/controllers/NoticeController.php

@@ -28,6 +28,7 @@ class NoticeController extends PublicController
         $total_fee = $postObj->total_fee;
         $totalFee = $total_fee / 100;
         $attach = $postObj->attach;
+        $transactionId = $postObj->transaction_id ?? '';
         //接收流水类型、代金劵
         parse_str($attach);
         //流水类型
@@ -39,7 +40,7 @@ class NoticeController extends PublicController
 
         $wxPay = dict::getDict('payWay', 'wxPay');
         //支付成功后续流程
-        payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach);
+        payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
 
         echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
     }

+ 2 - 1
biz-hd/purchase/services/PurchaseService.php

@@ -190,7 +190,7 @@ class PurchaseService extends BaseService
     }
 
     //采购订单支付成功后回调处理流程
-    public static function thirdPay($payWay, $orderSn, $totalFee, $attach)
+    public static function thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId='')
     {
         $info = self::getByCondition(['orderSn' => $orderSn], true);
         if (empty($info)) {
@@ -204,6 +204,7 @@ class PurchaseService extends BaseService
             util::fail($msg);
         }
         $info->thirdPay = dict::getDict('thirdPay', 'onlineWay');
+        $info->thirdNo = $transactionId;
         $info->save();
         self::payAfter($info, $payWay);
 

+ 5 - 3
common/components/payUtil.php

@@ -13,7 +13,7 @@ use Yii;
 class payUtil
 {
 
-    public static function thirdPay($payWay, $capitalType, $orderSn, $totalFee, $attach)
+    public static function thirdPay($payWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId = '')
     {
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
@@ -27,7 +27,7 @@ class payUtil
                     break;
                 case dict::getDict('capitalType', 'xhPurchase', 'id'):
                     //零售采购订单
-                    PurchaseService::thirdPay($payWay, $orderSn, $totalFee, $attach);
+                    PurchaseService::thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId);
                     break;
                 case dict::getDict('capitalType', 'hdPurchaseClear', 'id'):
                     //零售采购订单结清欠款
@@ -47,8 +47,10 @@ class payUtil
                     break;
                 default:
             }
+
             $transaction->commit();
-        } catch (Exception $exception) {
+        } catch
+        (Exception $exception) {
             $transaction->rollBack();
             util::fail("支付回调处理失败 orderSn:{$orderSn} capitalType:{$capitalType}");
         }