shish il y a 2 ans
Parent
commit
59b659a516
2 fichiers modifiés avec 40 ajouts et 1 suppressions
  1. 21 1
      app-ghs/controllers/TestController.php
  2. 19 0
      common/components/lakala/Lakala.php

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

@@ -22,6 +22,26 @@ class TestController extends BaseController
 
     public $guestAccess = ['inform', 'notice', 'order-query', 'add-order', 'index'];
 
+    public function actionAliRun()
+    {
+        $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
+        $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';
+        $params = [
+            'appid' => 'OP00002119',
+            'serial_no' => '018b08cfddbd',
+            'merchant_no' => '82240505992000N',
+            'term_no' => 'C6337694',
+            'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
+            'lklCertificatePath' => $lklCertificatePath,
+        ];
+        $aliParams = [
+            'subMerchantId' => '601067347',
+        ];
+        $laResource = new Lakala($params);
+        $response = $laResource->openStateQuery($aliParams);
+        print_r($response);
+    }
+
     public function actionAliRun2()
     {
         $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
@@ -56,7 +76,7 @@ class TestController extends BaseController
         }
     }
 
-    public function actionAliRun()
+    public function actionAliRun3()
     {
         $merchantPrivateKeyPath = Yii::getAlias("@vendor/lakala") . '/production/api_private_key.pem';
         $lklCertificatePath = Yii::getAlias("@vendor/lakala") . '/production/lkl-apigw-v1.cer';

+ 19 - 0
common/components/lakala/Lakala.php

@@ -33,6 +33,25 @@ class Lakala
         }
     }
 
+    public function openStateQuery($params)
+    {
+        $subMerchantId = $params['subMerchantId'];
+        $arr = [
+            'merchantNo' => $this->merchant_no,
+            'subMerchantId' => $subMerchantId,
+            'tradeMode' => 'WECHAT',
+        ];
+        $baseRequestVO = [
+            'req_data' => $arr,
+            'req_time' => date("YmdHis"),
+            'version' => $this->version,
+        ];
+        $body = json_encode($baseRequestVO, JSON_UNESCAPED_UNICODE);
+        $authorization = $this->getAuthorization($body);
+        $url = 'https://s2.lakala.com/api/v2/mms/sme/mrchAuthStateQuery';
+        return $this->post($url, $body, $authorization);
+    }
+
     //收银台支付,APP支付和H5支付时使用 ssh 2023112
     public function cashierPay($params)
     {