moonsflyer 4 месяцев назад
Родитель
Сommit
c47b856b66
1 измененных файлов с 13 добавлено и 9 удалено
  1. 13 9
      app/common/service/GiftCardQrCodeService.php

+ 13 - 9
app/common/service/GiftCardQrCodeService.php

@@ -42,17 +42,21 @@ class GiftCardQrCodeService
             $app = Factory::miniProgram($config);
             $accessToken = $app->access_token->getToken()['access_token'];
             outFileLog($accessToken,'qr_code','$accessToken');
-            $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={$accessToken}";
-
+            // $url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={$accessToken}";
+            $url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token={$accessToken}";
             $data = [
-                'scene' => $scene,
-                'page' => $page,
-                'width' => 430,  // 推荐使用430像素,确保方形
-                'auto_color' => false,  // 不自动配色
-                'line_color' => ['r' => 0, 'g' => 0, 'b' => 0],  // 黑色线条
-                'is_hyaline' => true,   // 透明背景,去除logo区域
-                'env_version' => 'release'  // 添加版本参数
+                'page' => $page.'?cardPass='. '?cardPass=' . urlencode($cardPass),
+                'width' => 430  // 方形尺寸
             ];
+            // $data = [
+            //     'scene' => $scene,
+            //     'page' => $page,
+            //     'width' => 430,  // 推荐使用430像素,确保方形
+            //     'auto_color' => false,  // 不自动配色
+            //     'line_color' => ['r' => 0, 'g' => 0, 'b' => 0],  // 黑色线条
+            //     'is_hyaline' => true,   // 透明背景,去除logo区域
+            //     'env_version' => 'release'  // 添加版本参数
+            // ];
 
             Log::info('生成小程序码参数', [
                 'scene' => $scene,