From e3a9429395e194e6ec9f95df2c2f248ed84affd5 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Wed, 8 Jul 2026 15:59:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=B4=E4=BF=AE=E8=BD=A6?= =?UTF-8?q?=E4=BD=8D=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/ParkingSpaceRepairService.php | 13 +++++++++++-- app/Services/ParkingSpaceService.php | 3 +++ resources/lang/en/service.php | 3 ++- resources/lang/zh-CN/service.php | 3 ++- resources/lang/zh-TW/service.php | 3 ++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/Services/ParkingSpaceRepairService.php b/app/Services/ParkingSpaceRepairService.php index ddd8b5f..9bd94ae 100644 --- a/app/Services/ParkingSpaceRepairService.php +++ b/app/Services/ParkingSpaceRepairService.php @@ -62,13 +62,22 @@ class ParkingSpaceRepairService extends BaseService DB::beginTransaction(); $spaceNameArr = explode(',', $data['parking_space_name']); foreach ($spaceNameArr as $parking_space_name) { - $space_id = ParkingSpace::getValueId($parking_space_name); - if (!$space_id) { + $space = ParkingSpace::query()->where('number', $parking_space_name)->first(); + if (!$space) { throw new CustomException( __service($this->menuTitle . '.space_not_exists') . ':' . $parking_space_name ); } + // 维修状态不可添加 + $space = $space->toArray(); + $space_id = $space['id']; + if ($space['status'] == 2) { + throw new CustomException( + __service($this->menuTitle . '.space_exists') + . ':' . $parking_space_name + ); + } $model = $this->createData( $space_id, $data['admin_user_id'], diff --git a/app/Services/ParkingSpaceService.php b/app/Services/ParkingSpaceService.php index dc97d46..2a1f82e 100644 --- a/app/Services/ParkingSpaceService.php +++ b/app/Services/ParkingSpaceService.php @@ -358,6 +358,9 @@ class ParkingSpaceService extends BaseService } if ($status == 2) { // 维修 + if ($oldValues['status'] == 2) { + throw new CustomException(__validation('parking_repair_list.space_exists')); + } $now_times = time(); $start_times = strtotime($start_at);// 维修开始时间 $end_times = strtotime($end_at);// 维修结束时间 diff --git a/resources/lang/en/service.php b/resources/lang/en/service.php index 4224c8d..ff74aca 100644 --- a/resources/lang/en/service.php +++ b/resources/lang/en/service.php @@ -172,7 +172,8 @@ return [ 'not_synced' => 'Not synced', 'synced' => 'Synchronized', 'space_not_exists' => 'The parking number does not exist', - 'not_send' => 'There is currently no information available for sending maintenance parking space information.' + 'not_send' => 'There is currently no information available for sending maintenance parking space information.', + 'space_exists' => 'Parking space under repair' ], 'gate_control' => [ 'automatic' => 'Automatic entry', diff --git a/resources/lang/zh-CN/service.php b/resources/lang/zh-CN/service.php index a9875b1..65ccc4f 100644 --- a/resources/lang/zh-CN/service.php +++ b/resources/lang/zh-CN/service.php @@ -172,7 +172,8 @@ return [ 'not_synced' => '未同步', 'synced' => '已同步', 'space_not_exists' => '车位号不存在', - 'not_send' => '目前暂无可发送的维修车位信息' + 'not_send' => '目前暂无可发送的维修车位信息', + 'space_exists' => '车位维修中' ], 'gate_control' => [ 'automatic' => '自动入场', diff --git a/resources/lang/zh-TW/service.php b/resources/lang/zh-TW/service.php index 50b5173..8827ec0 100644 --- a/resources/lang/zh-TW/service.php +++ b/resources/lang/zh-TW/service.php @@ -172,7 +172,8 @@ return [ 'not_synced' => '未同步', 'synced' => '已同步', 'space_not_exists' => '車位號不存在', - 'not_send' => '目前暫無可發送的維修車位信息' + 'not_send' => '目前暫無可發送的維修車位信息', + 'space_exists' => '車位維修中' ], 'gate_control' => [ 'automatic' => '自動入場',