shish 2 лет назад
Родитель
Сommit
3cf7f6ebdc
1 измененных файлов с 21 добавлено и 2 удалено
  1. 21 2
      app-ghs/controllers/TestController.php

+ 21 - 2
app-ghs/controllers/TestController.php

@@ -15,6 +15,7 @@ use common\components\lakala\Lakala;
 use common\components\miniUtil;
 use common\components\orderSn;
 use common\components\wxUtil;
+use common\components\payUtil;
 use Yii;
 use common\components\util;
 
@@ -183,8 +184,26 @@ class TestController extends BaseController
             'tradeNo' => '20231021110113130266215211135188',
         ];
         $response = $laResource->query($queryParams, 1);
-        echo "<pre>";
-        print_r($response);
+        if (isset($response['code']) && $response['code'] == 'BBS00000') {
+            $capitalType = dict::getDict('capitalType', 'hdPurchaseClear', 'id');
+            $connection = Yii::$app->db;
+            $transaction = $connection->beginTransaction();
+            try {
+                $wxPay = dict::getDict('payWay', 'wxPay');
+                //支付成功后续流程
+                $attach = '';
+                $payer_amount = $response['resp_data']['payer_amount'] ?? 0;
+                $orderSn = 'CL28681399';
+                $totalFee = $payer_amount / 100;
+                $transactionId = '20231021110113130266215211135188';
+                payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
+                $transaction->commit();
+                echo 'OK';
+            } catch (\Exception $e) {
+                $transaction->rollBack();
+                Yii::error("失败原因:" . $e->getMessage());
+            }
+        }
     }
 
     public function actionAliRun2()