From 47d2957272ddc899159074a341d8b11d9fcc4a18 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq.com> Date: Tue, 28 Apr 2026 16:09:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=98=E5=88=B6=E5=9C=B0=E5=9B=BE=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/ParkingElectronicMapController.php | 10 ++++++++-- app/Services/ParkingElectronicMapService.php | 9 ++++++++- ...43449_create_parking_electronic_map_table.php | 5 +++++ resources/lang/zh-CN/validation.php | 16 ++++++++++++++-- 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Admin/ParkingElectronicMapController.php b/app/Http/Controllers/Admin/ParkingElectronicMapController.php index 3558338..8e34aac 100644 --- a/app/Http/Controllers/Admin/ParkingElectronicMapController.php +++ b/app/Http/Controllers/Admin/ParkingElectronicMapController.php @@ -125,8 +125,14 @@ class ParkingElectronicMapController extends BaseController { try { $data = $request->all(); - $this->saveValidator($data, 1); - $this->service->saveModel($data); + $saveData = $data['saveData'] ?? []; + if (empty($saveData)) { + throw new Exception(__('validation.map.d_empty')); + } + foreach ($saveData as $item) { + $this->saveValidator($item, 1); + $this->service->saveModel($item); + } return $this->responseService->success([], __('admin.save_succeeded')); } catch (Exception $e) { $m_prefix = __('admin.save_failed'); diff --git a/app/Services/ParkingElectronicMapService.php b/app/Services/ParkingElectronicMapService.php index 6ea1401..548b7b6 100644 --- a/app/Services/ParkingElectronicMapService.php +++ b/app/Services/ParkingElectronicMapService.php @@ -34,6 +34,10 @@ class ParkingElectronicMapService extends BaseService $saveData['height'] = $data['height'] ?? '0'; $saveData['coordinate_x'] = $data['coordinate_x'] ?? ''; $saveData['coordinate_y'] = $data['coordinate_y'] ?? ''; + $saveData['min_width'] = $data['min_width'] ?? ''; + $saveData['min_height'] = $data['min_height'] ?? ''; + $saveData['keep_aspect_ratio'] = $data['keep_aspect_ratio'] ?? '0'; + $saveData['aspect_ratio'] = $data['aspect_ratio'] ?? ''; if ($res) { $saveData['update_at'] = get_datetime(); $model = ParkingElectronicMap::query()->findOrFail($res[0]['id']); @@ -65,7 +69,10 @@ class ParkingElectronicMapService extends BaseService 'width', 'height', 'coordinate_x', - 'coordinate_y' + 'min_width', + 'min_height', + 'keep_aspect_ratio', + 'aspect_ratio' ]; $list = ParkingElectronicMap::query()->where($where)->select($columns) ->get()->toArray(); diff --git a/database/migrations/2026_04_23_143449_create_parking_electronic_map_table.php b/database/migrations/2026_04_23_143449_create_parking_electronic_map_table.php index cd81389..7da78be 100644 --- a/database/migrations/2026_04_23_143449_create_parking_electronic_map_table.php +++ b/database/migrations/2026_04_23_143449_create_parking_electronic_map_table.php @@ -19,6 +19,11 @@ return new class extends Migration $table->string('height', 20)->default('')->comment('高'); $table->string('coordinate_x', 20)->default('')->comment('坐标X'); $table->string('coordinate_y', 20)->default('')->comment('坐标y'); + $table->string('min_width', 20)->default(''); + $table->string('min_height', 20)->default(''); + $table->tinyInteger('keep_aspect_ratio')->default('0')->comment('0 false 1 true'); + $table->string('aspect_ratio', 20)->default(''); + $table->innoDb(); $table->timestamps(); }); } diff --git a/resources/lang/zh-CN/validation.php b/resources/lang/zh-CN/validation.php index b17c3f2..ca9f3cf 100644 --- a/resources/lang/zh-CN/validation.php +++ b/resources/lang/zh-CN/validation.php @@ -77,10 +77,22 @@ return [ 'ids_empty' => '车位数据不能为空', 'ids_array' => '车位数据必须是数组', ], - 'map' => [ + 'map' => [ 'f_empty' => '楼层编号不能为空', 'f_number' => '楼层编号必须是数字', 'p_empty' => '车位编号必须是数字', - 'p_number' => '车位编号必须是数字' + 'p_number' => '车位编号必须是数字', + 'd_empty' => '保存数据不能为空' + ], + 'parking_camera' => [ + 'n_empty' => '设备编号不能为空', + 'n_max' => '车牌号码最多50个字符', + 's_empty' => '服务器IP不能为空', + 's_max' => '服务器IP最多15个字符', + 'c_empty' => '相机IP不能为空', + 'c_max' => '相机IP最多15个字符', + 'p_array' => '车位数据必须是数组', + 'lights_ip_empty' => '控灯相机IP不能为空', + 'lights_ip_max' => '控灯相机IP最多15个字符' ] ];