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