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

+ 6 - 4
app/common/service/GiftCardQrCodeService.php

@@ -41,7 +41,7 @@ class GiftCardQrCodeService
             $config = WeChatConfigService::getMnpConfig();
             $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}";
 
             $data = [
@@ -71,13 +71,14 @@ class GiftCardQrCodeService
             curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
 
             $response = curl_exec($ch);
+            outFileLog($response,'qr_code','$response');
             $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
             curl_close($ch);
-
+            outFileLog($httpCode,'qr_code','$httpCode');
             if ($httpCode === 200) {
                 // 检查是否为JSON错误响应
                 $jsonData = json_decode($response, true);
-                return 'uploads/images/20250815/2025081515081098d733968.jpg';
+                outFileLog($jsonData,'qr_code','$jsonData');
                 if ($jsonData && isset($jsonData['errcode'])) {
                     Log::error('微信API错误', $jsonData);
                     return false;
@@ -120,8 +121,9 @@ class GiftCardQrCodeService
 
                 // 上传到七牛云
                 $remotePath = 'gift_card/qr_code/' . $fileName;
+                outFileLog($remotePath,'qr_code','$remotePath');
                 $uploadResult = self::uploadToQiniu($localPath, $remotePath);
-
+                outFileLog($uploadResult,'qr_code','$uploadResult');
                 if ($uploadResult) {
                     Log::info('二维码上传七牛云成功', [
                         'localPath' => $localPath,