shish пре 2 година
родитељ
комит
0c8acdd82e
1 измењених фајлова са 13 додато и 10 уклоњено
  1. 13 10
      app-ghs/controllers/TestController.php

+ 13 - 10
app-ghs/controllers/TestController.php

@@ -312,34 +312,37 @@ class TestController extends BaseController
         die;
         util::stop();
         if (isset($response['code']) && $response['code'] == 'BBS00000') {
-            $capitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
+
             $connection = Yii::$app->db;
             $transaction = $connection->beginTransaction();
             try {
 
-                $account_type = $response['resp_data']['account_type'] ?? 0;
+                $postData = $response['resp_data'] ?? [];
+                $total_amount = $postData['total_amount'] ?? 0;
+                $account_type = $postData['account_type'] ?? '';
                 if (empty($account_type)) {
-                    noticeUtil::push('支付回调失败了,没有找到钱包类型,请注意', '15280215347');
+                    noticeUtil::push('支付回调失败了,没有找到钱包类型,请注意,orderSn:' . $orderSn, '15280215347');
                     util::end();
                 }
+                $totalFee = $total_amount / 100;
+                $transactionId = $postData['trade_no'] ?? 0;
+                $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
+
                 $currentPayWay = null;
                 if ($account_type == 'WECHAT') {
                     $currentPayWay = dict::getDict('payWay', 'wxPay');
                 } elseif ($account_type == 'ALIPAY') {
                     $currentPayWay = dict::getDict('payWay', 'alipay');
                 } else {
-                    noticeUtil::push('支付回调失败了,没有找到支付类型', '15280215347');
+                    noticeUtil::push('支付回调失败了,没有找到支付类型,orderSn:' . $orderSn, '15280215347');
                     util::end();
                 }
-
+                echo $currentPayWay.' '.$capitalType.' '.$orderSn.' '.$totalFee.' '.$transactionId;
+                die;
                 $attach = '';
-                $total_amount = $response['resp_data']['total_amount'] ?? 0;
-                $orderSn = $response['resp_data']['out_trade_no'] ?? 0;
-                $totalFee = $total_amount / 100;
-                $transactionId = $response['resp_data']['trade_no'] ?? 0;
                 payUtil::thirdPay($currentPayWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
                 $transaction->commit();
-                echo 'OK';
+
             } catch (\Exception $e) {
                 $transaction->rollBack();
                 Yii::error("失败原因:" . $e->getMessage());