shish %!s(int64=2) %!d(string=hai) anos
pai
achega
dda5ce5e20
Modificáronse 1 ficheiros con 39 adicións e 2 borrados
  1. 39 2
      app-ghs/controllers/TestController.php

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

@@ -31,9 +31,13 @@ class TestController extends BaseController
         $arr = [
             ['name' => '国兰花尚', 'merchantNo' => '82239305992006L', 'wx' => [600913569, 600907053], 'zfb' => '2088820709029782']
         ];
+        $new = [];
         foreach ($arr as $item) {
             $wx = $item['wx'];
+            $zfb = $item['zfb'];
+            $name = $item['name'];
             $merchantNo = $item['merchantNo'];
+            $group = [];
             foreach ($wx as $oneWx) {
                 $params = [
                     'appid' => 'OP00002119',
@@ -49,10 +53,43 @@ class TestController extends BaseController
                 ];
                 $laResource = new Lakala($params);
                 $response = $laResource->openStateQuery($data);
-                print_r($response);
-                die;
+                $statusName = '出错了';
+                if ($response['retCode'] == '000000') {
+                    $checkResult = $response['respData']['checkResult'] ?? '';
+                    $statusName = '未授权';
+                    if ($checkResult == 'AUTHORIZE_STATE_AUTHORIZED ') {
+                        $statusName = '已授权';
+                    }
+                }
+                $group[] = '微信 ' . $oneWx . ' ' . $statusName;
             }
+
+            $params = [
+                'appid' => 'OP00002119',
+                'serial_no' => '018b08cfddbd',
+                'merchant_no' => $merchantNo,
+                'term_no' => 'C6337694',
+                'merchantPrivateKeyPath' => $merchantPrivateKeyPath,
+                'lklCertificatePath' => $lklCertificatePath,
+            ];
+            $data = [
+                'subMerchantId' => $zfb,
+                'tradeMode' => 'ALIPAY',
+            ];
+            $laResource = new Lakala($params);
+            $response = $laResource->openStateQuery($data);
+            $statusName = '出错了';
+            if ($response['retCode'] == '000000') {
+                $checkResult = $response['respData']['checkResult'] ?? '';
+                $statusName = '未授权';
+                if ($checkResult == 'AUTHORIZE_STATE_AUTHORIZED ') {
+                    $statusName = '已授权';
+                }
+            }
+            $group[] = '支付宝 ' . $zfb . ' ' . $statusName;
+            $new[] = ['name' => $name, 'status' => $group];
         }
+        print_r($new);
     }
 
     public function actionAliRun2()