|
|
@@ -4,7 +4,6 @@ namespace app\common\service;
|
|
|
|
|
|
use app\common\service\storage\Driver;
|
|
|
use app\common\service\ConfigService;
|
|
|
-// 修改这一行:移除Facades的使用
|
|
|
use SimpleSoftwareIO\QrCode\Generator;
|
|
|
use think\facade\Log;
|
|
|
use app\common\service\WeChatConfigService;
|
|
|
@@ -27,24 +26,22 @@ class GiftCardQrCodeService
|
|
|
try {
|
|
|
// Generate regular QR code with cardPass as content
|
|
|
$qrContent = $cardPass;
|
|
|
- outFileLog($qrContent, 'qr_code', '$qrContent');
|
|
|
+
|
|
|
// Generate local temp file path
|
|
|
$tempDir = runtime_path() . 'temp' . DIRECTORY_SEPARATOR;
|
|
|
if (!is_dir($tempDir)) {
|
|
|
mkdir($tempDir, 0755, true);
|
|
|
}
|
|
|
- outFileLog($tempDir, 'qr_code', '$tempDir');
|
|
|
+
|
|
|
$tempFileName = 'qrcode_' . $cardNo . '_' . time() . '.png';
|
|
|
$tempFilePath = $tempDir . $tempFileName;
|
|
|
- outFileLog($tempFileName, 'qr_code', '$tempFileName');
|
|
|
+ outFileLog($qrContent, 'qr_code', '$qrContent');
|
|
|
outFileLog($tempFilePath, 'qr_code', '$tempFilePath');
|
|
|
- // 修改这部分:使用Generator类而不是Facade
|
|
|
- $qrCode = new Generator();
|
|
|
- $qrCode->size(430)
|
|
|
- ->margin(2)
|
|
|
- ->format('png')
|
|
|
- ->generate($qrContent, $tempFilePath);
|
|
|
- outFileLog($qrCode, 'qr_code', '$qrCode');
|
|
|
+ // 正确的使用方式
|
|
|
+ // 可以直接在一行中完成
|
|
|
+ $qrcode = new Generator();
|
|
|
+ $qrcode->size(430)->margin(2)->format('png')->generate($qrContent, $tempFilePath);
|
|
|
+ outFileLog($qrcode, 'qr_code', '$qrcode');
|
|
|
Log::info('Regular QR code generated successfully', [
|
|
|
'cardNo' => $cardNo,
|
|
|
'scene' => $cardPass,
|