pdf文件地址

This commit is contained in:
2026-01-15 10:47:21 +08:00
parent 842d502bf0
commit c5a65921f7
+8 -1
View File
@@ -395,9 +395,16 @@ class UsedCarController extends BaseController
if (!file_exists($publicFile)) {
copy($filePath, $publicFile);
}
// 从连接中获取协议(最可靠)
$connection = $request->connection;
$protocol = 'https';
if ($connection && property_exists($connection, 'transport')) {
$protocol = $connection->transport === 'ssl' ? 'https' : 'http';
}
// 返回访问地址
$baseUrl = 'http://' . request()->header('host');
$baseUrl = $protocol.'://' . request()->header('host');
$url = $baseUrl . '/pdf/' . $raw['pdf_src'];
return $this->success([