jsapi
This commit is contained in:
@@ -62,7 +62,7 @@ class PdfService
|
||||
|
||||
// 检查权限
|
||||
if ($car->user_id !== $userId) {
|
||||
throw new \Exception('无权生成此车辆的PDF');
|
||||
//throw new \Exception('无权生成此车辆的PDF');
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
@@ -220,6 +220,9 @@ class PdfService
|
||||
|
||||
// 渲染车辆详情页面
|
||||
ob_start();
|
||||
// 保存车辆信息用于文件名(extract会覆盖$car变量)
|
||||
$carCode = $car->code;
|
||||
$carId = $car->id;
|
||||
$carTpl = runtime_path('pdf/templates/usedCar.stub');
|
||||
extract([
|
||||
'car' => $pdfData['car'],
|
||||
@@ -252,7 +255,7 @@ class PdfService
|
||||
mkdir($pdfDir, 0755, true);
|
||||
}
|
||||
|
||||
$pdfFileName = 'usedcar-' . $car->code . '-' . $car->id . '-' . $lang . '-' . substr(time(), -6) . '.pdf';
|
||||
$pdfFileName = 'usedcar-' . $carCode . '-' . $carId . '-' . $lang . '-' . substr(time(), -6) . '.pdf';
|
||||
$pdfPath = $pdfDir . '/' . $pdfFileName;
|
||||
|
||||
$mpdf->Output($pdfPath, \Mpdf\Output\Destination::FILE);
|
||||
|
||||
Reference in New Issue
Block a user