shish 2 years ago
parent
commit
28d10551a0
2 changed files with 36 additions and 3 deletions
  1. 1 1
      app-ghs/controllers/OrderController.php
  2. 35 2
      common/components/lakala/Lakala.php

+ 1 - 1
app-ghs/controllers/OrderController.php

@@ -275,7 +275,7 @@ class OrderController extends BaseController
                     'subject' => $subject,
                     'couponId' => 0,
                 ];
-                $response = $laResource->driveWxPay($wxParams);
+                $response = $laResource->driveNativeWxPay($wxParams);
                 if (isset($response['code']) == false || $response['code'] != 'BBS00000') {
                     $msg = $response['msg'] ?? '';
                     noticeUtil::push($msg, '15280215347');

+ 35 - 2
common/components/lakala/Lakala.php

@@ -97,13 +97,12 @@ class Lakala
         $openId = $params['openId'] ?? '';
         $ip = $this->getClientIp();
         $location_info = ['request_ip' => $ip];
-        $trans_type = $params['transType'] ?? 71;
         $arr = [
             'merchant_no' => $this->merchant_no,
             'term_no' => $this->term_no,
             'out_trade_no' => $orderSn,
             'account_type' => 'WECHAT',
-            'trans_type' => $trans_type,
+            'trans_type' => 71,
             'total_amount' => $amount * 100,
             'location_info' => $location_info,
             'subject' => $subject,
@@ -125,6 +124,40 @@ class Lakala
         return $this->post($this->preUrl . 'preorder', $body, $authorization);
     }
 
+    public function driveNativeWxPay($params)
+    {
+        $orderSn = $params['orderSn'];
+        $amount = $params['amount'];
+        $notifyUrl = $params['notifyUrl'];
+        $subject = $params['subject'];
+        $capitalType = $params['capitalType'];
+        $ip = $this->getClientIp();
+        $location_info = ['request_ip' => $ip];
+        $arr = [
+            'merchant_no' => $this->merchant_no,
+            'term_no' => $this->term_no,
+            'out_trade_no' => $orderSn,
+            'account_type' => 'WECHAT',
+            'trans_type' => 71,
+            'total_amount' => $amount * 100,
+            'location_info' => $location_info,
+            'subject' => $subject,
+            'notify_url' => $notifyUrl,
+            'remark' => '{"capitalType":' . $capitalType . '}',
+            'acc_busi_fields' => [
+                'timeout_express' => 30,
+            ],
+        ];
+        $baseRequestVO = [
+            'req_data' => $arr,
+            'req_time' => date("YmdHis"),
+            'version' => $this->version,
+        ];
+        $body = json_encode($baseRequestVO, JSON_UNESCAPED_UNICODE);
+        $authorization = $this->getAuthorization($body);
+        return $this->post($this->preUrl . 'preorder', $body, $authorization);
+    }
+
     //主扫交易,支付宝
     public function driveAliPay($params)
     {