From 4e3bbb2774d11f30adcb49cc99d116e4dc951d1b Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 19 Jan 2026 10:23:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96pdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/UsedCarController.php | 8 ++++---- app/common/utils/pdf/service/MpdfDriver.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/common/controller/UsedCarController.php b/app/common/controller/UsedCarController.php index 2fa9f52..0376187 100644 --- a/app/common/controller/UsedCarController.php +++ b/app/common/controller/UsedCarController.php @@ -157,7 +157,7 @@ class UsedCarController extends BaseController 'crawl_series_id' => $info['series_id'], 'crawl_series' => $info['series_name'], 'used_car_id' => $info['used_car_id'], - 'crawl_year' => $info['crawl_year'], + 'crawl_year' => $info['year'], 'plate_time' => $info['plate_time'], ]; @@ -229,7 +229,7 @@ class UsedCarController extends BaseController $field = $this->field($lang);//字段相关外文 $field['currency'] = $this->currency[$currency]; - $data['product_name'] = $data['crawl_brand'].' '.$data['crawl_series'].' '.$data['crawl_title']; + $data['product_name'] = $data['crawl_brand'].' '.$data['crawl_series'].' '. $data['crawl_year'] .'款 '.$data['crawl_title']; $data = $this->fanyi($data, $lang);//车辆字段翻译外文 $contactField = $this->contact($lang); //名片相关外文 $data['trade'] = $trade; @@ -261,7 +261,7 @@ class UsedCarController extends BaseController return response()->download( $filePath, - $raw['product_name'].'-'.$raw['id'].'.pdf' // 下载时显示的文件名 + $raw['product_name']. '-' .$raw['code'].'-'.$raw['id'].'.pdf' // 下载时显示的文件名 ); } @@ -466,7 +466,7 @@ class UsedCarController extends BaseController return $this->success([ 'pdf_url' => $url, - 'file_name' => $raw['product_name'] . '-' . $raw['id'] . '.pdf' + 'file_name' => $raw['product_name']. '-' .$raw['code']. '-' . $raw['id'] . '.pdf' ]); } catch (\Throwable $e) { return $this->error($e->getMessage()); diff --git a/app/common/utils/pdf/service/MpdfDriver.php b/app/common/utils/pdf/service/MpdfDriver.php index c56761d..61af5bb 100644 --- a/app/common/utils/pdf/service/MpdfDriver.php +++ b/app/common/utils/pdf/service/MpdfDriver.php @@ -186,7 +186,7 @@ class MpdfDriver $pdf = $mpdf->Output('车辆详情.pdf', 'S'); $dir = runtime_path('pdf'); if (!is_dir($dir)) mkdir($dir, 0777, true); - $pdfName = 'invoice-' . date('YmdHis').'-'.$car['id'] . '-' . $lang . '.pdf'; + $pdfName = 'invoice-' . $car['code'].'-'.$car['id'] . '-' . $lang . '.pdf'; $path = $dir . '/' . $pdfName; file_put_contents($path, $pdf);