diff --git a/app/admin/logic/StatisticsLogic.php b/app/admin/logic/StatisticsLogic.php index 40f7c943..d0d72957 100644 --- a/app/admin/logic/StatisticsLogic.php +++ b/app/admin/logic/StatisticsLogic.php @@ -309,7 +309,7 @@ class StatisticsLogic extends Logic return ['count' => $goods_count, 'lists' => $goods_list]; } - public static function makeMpWechatQrcode( string $type = 'base64', array $extra = []) + public static function makeMpWechatQrcode( string $type = 'url', array $extra = []) { try { @@ -355,9 +355,16 @@ class StatisticsLogic extends Logic $contents = $save_dir . $file_name; } break; + case 'url': // 保存并返回完整URL + $full_path = $save_dir . $file_name; + file_put_contents($full_path, $contents); + // 生成完整的可访问URL(根据实际域名调整) + $contents = request()->domain() . '/uploads/wxqrcode/' . $file_name; + break; case 'base64': $mp_base64 = chunk_split(base64_encode($contents)); $contents = 'data:image/png;base64,' . $mp_base64; + break; } return data_success('',['qr_code'=>$contents, 'extra' => $extra]);