From 434f8a781af5fc07d07ef3689903de4fe8171b5c Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Wed, 17 Jun 2026 17:56:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=A0=87=E9=A2=98=E7=BF=BB?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Exports/ParkingVipListImportTemplateExport.php | 2 +- app/Imports/ParkingVipListImport.php | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/Exports/ParkingVipListImportTemplateExport.php b/app/Exports/ParkingVipListImportTemplateExport.php index 6cdd477..8b7ed74 100644 --- a/app/Exports/ParkingVipListImportTemplateExport.php +++ b/app/Exports/ParkingVipListImportTemplateExport.php @@ -10,7 +10,7 @@ class ParkingVipListImportTemplateExport implements FromArray public function array(): array { return [ - ['No.', 'License Plate No.'], + [__exports('global.index'), __exports('parking_space.license_plate')], ['1', '测A88887'] ]; } diff --git a/app/Imports/ParkingVipListImport.php b/app/Imports/ParkingVipListImport.php index a9a0712..3c70e30 100644 --- a/app/Imports/ParkingVipListImport.php +++ b/app/Imports/ParkingVipListImport.php @@ -7,15 +7,15 @@ use App\Services\OperationLogService; use App\Services\ParkingLicensePlateService; use Illuminate\Support\Facades\Auth; use Maatwebsite\Excel\Concerns\ToModel; -use Maatwebsite\Excel\Concerns\WithHeadingRow; -class ParkingVipListImport implements ToModel, WithHeadingRow +class ParkingVipListImport implements ToModel { /** * @var OperationLogService */ private OperationLogService $logService; + protected int $index = 1; public function __construct() { @@ -28,8 +28,12 @@ class ParkingVipListImport implements ToModel, WithHeadingRow */ public function model(array $row) { - if (isset($row['license_plate_no']) && $row['license_plate_no']) { - $license = $row['license_plate_no']; + if ($this->index == 1) { + $this->index += 1; + return; + } + if (isset($row[1]) && $row[1]) { + $license = $row[1]; $license_id = (new ParkingLicensePlateService($this->logService))->createLicenseId($license); if (!ParkingVipList::query()->where('license_id', $license_id) ->exists()