diff --git a/app/Http/Controllers/Admin/ParkingAlarmInformationController.php b/app/Http/Controllers/Admin/ParkingAlarmInformationController.php new file mode 100644 index 0000000..bff4c23 --- /dev/null +++ b/app/Http/Controllers/Admin/ParkingAlarmInformationController.php @@ -0,0 +1,184 @@ +service = $service; + } + + public function index(Request $request): JsonResponse + { + try { + $query = ParkingAlarmInformation::query(); + + if ($request->has('keyword')) { + $keyword = $request->input('keyword'); + if ($keyword) { + $query->where(function ($q) use ($keyword) { + $q->orWhere('name', $keyword); + $q->orWhere('condition', $keyword); + $q->orWhere('content', $keyword); + $q->orWhere('remark', $keyword); + }); + } + } + + if ($request->has('type')) { + $type = $request->input('type'); + if ($type) { + $query->where('type', $type); + } + } + + if ($request->has('notice_type')) { + $notice_type = $request->input('notice_type'); + if ($notice_type) { + $query->where('notice_type', $notice_type); + } + } + + if ($request->has('level')) { + $level = $request->input('level'); + if ($level) { + $query->where('level', $level); + } + } + + // 分页 + $page = $request->input('page', 1); + $perPage = $request->input('per_page', 10); + $total = $query->count(); + $query->orderBy('id'); + $items = $query->latest()->forPage($page, $perPage)->select() + ->get()->each(function ($item) { + return $this->service->getItem($item); + }); + + return $this->responseService->success([ + 'items' => $items, + 'total' => $total, + 'page' => $page, + 'per_page' => $perPage, + 'last_page' => ceil($total / $perPage), + ]); + } catch (Exception $e) { + $m_prefix = __('exception.exception_handler.resource'); + return $this->responseService->systemError( + $m_prefix . ':' . $e->getMessage() + ); + } + } + + public function show(string $id): JsonResponse + { + try { + $data = ParkingAlarmInformation::query()->find($id)->toArray(); + $data = $this->service->getItem($data); + return $this->responseService->success($data); + } catch (Exception $e) { + return $this->responseService->systemError( + __('exception.get_data_failed') . ':' . $e->getMessage() + ); + } + } + + public function search(): JsonResponse + { + try { + $data = [ + 'type_list' => get_select_data( + $this->service->getTypeArr() + ), + 'notice_type_list' => get_select_data( + $this->service->getNoticeTypeArr() + ), + 'level_list' => get_select_data( + $this->service->getLevelArr() + ), + 'handler_user_list' => get_select_data( + $this->service->getHandlerUserArr() + ) + ]; + return $this->responseService->success($data); + } catch (Exception $e) { + $m_prefix = __('exception.exception_handler.resource'); + return $this->responseService->systemError( + $m_prefix . ':' . $e->getMessage() + ); + } + } + + public function allocation(Request $request): JsonResponse + { + try { + $data = $request->all(); + $this->validateId($data['id'] ?? 0, ParkingAlarmInformation::class); + $this->service->allocation( + $data['id'], + $data['handler_user'] + ); + return $this->responseService->success( + null, + __('admin.operation_successful') + ); + } catch (ValidationException|CustomException $e) { + throw $e; + } catch (Exception $e) { + return $this->responseService->systemError( + __('admin.operation_failed') . ':' + . $e->getMessage() + ); + } + + } + + public function editRemark(Request $request): JsonResponse + { + try { + $data = $request->all(); + $this->validateId($data['id'] ?? 0, ParkingAlarmInformation::class); + $this->service->editRemark( + $data['id'], + $data['remark'] ?? '' + ); + return $this->responseService->success( + null, + __('admin.operation_successful') + ); + } catch (ValidationException|CustomException $e) { + throw $e; + } catch (Exception $e) { + return $this->responseService->systemError( + __('admin.operation_failed') . ':' + . $e->getMessage() + ); + } + } +} diff --git a/app/Models/AdminTranslation.php b/app/Models/AdminTranslation.php index fb8566b..9c17d9f 100644 --- a/app/Models/AdminTranslation.php +++ b/app/Models/AdminTranslation.php @@ -25,13 +25,4 @@ class AdminTranslation extends Model 'deleted_at', 'created_at' ]; - - /* - 翻译type 说明 - 1 车位类型 - 2 车位属性 - 3 停车场 - 4 楼层管理 - 5 区域管理 - */ } diff --git a/app/Models/ParkingAlarmInformation.php b/app/Models/ParkingAlarmInformation.php new file mode 100644 index 0000000..172f12e --- /dev/null +++ b/app/Models/ParkingAlarmInformation.php @@ -0,0 +1,33 @@ + 'scene', + 2 => 'notice' + ]; + public array $noticeTypeArr + = [ + 1 => 'info_notice', + 2 => 'support_notice' + ]; + public array $levelArr + = [ + 1 => 'urgent', + 2 => 'high', + 3 => 'middle', + 4 => 'low', + 5 => 'info' + ]; + public array $handlerUserArr + = [ + 1 => 'handler1', + 2 => 'handler2', + 3 => 'handler3', + 4 => 'handler4' + ]; + protected string $menuTitle = 'alarm_information'; + + public function getItem($item) + { + $item['name'] = AdminTranslationService::getTranslationTypeName( + $item['id'], + 100, + $item['name'] + ); + $typeArr = $this->getTypeArr(); + $item['type_str'] = $typeArr[$item['type']]; + $noticeTypeArr = $this->getNoticeTypeArr(); + $item['notice_type_str'] = $noticeTypeArr[$item['notice_type']]; + $levelArr = $this->getLevelArr(); + $item['level_str'] = $levelArr[$item['level']]; + $item['condition'] = AdminTranslationService::getTranslationTypeName( + $item['id'], + 101, + $item['condition'] + ); + $item['content'] = AdminTranslationService::getTranslationTypeName( + $item['id'], + 102, + $item['content'] + ); + $item['remark'] = AdminTranslationService::getTranslationTypeName( + $item['id'], + 103, + $item['remark'] + ); + $handlerUserArr = $this->getHandlerUserArr(); + $item['handler_user'] = $handlerUserArr[$item['handler_user']] ?? ''; + $item['handler_remark'] + = AdminTranslationService::getTranslationTypeName( + $item['id'], + 104, + $item['handler_remark'] + ); + return $item; + } + + /** + * @return array|string[] + */ + public function getTypeArr(): array + { + $typeArr = $this->typeArr; + foreach ($typeArr as $key => $value) { + $typeArr[$key] = __service($this->menuTitle . '.' . $value); + } + return $typeArr; + } + + /** + * @return array|string[] + */ + public function getNoticeTypeArr(): array + { + $noticeTypeArr = $this->noticeTypeArr; + foreach ($noticeTypeArr as $key => $value) { + $noticeTypeArr[$key] = __service($this->menuTitle . '.' . $value); + } + return $noticeTypeArr; + } + + /** + * @return array|string[] + */ + public function getLevelArr(): array + { + $levelArr = $this->levelArr; + foreach ($levelArr as $key => $value) { + $levelArr[$key] = __service($this->menuTitle . '.' . $value); + } + return $levelArr; + } + + /** + * @return array|string[] + */ + public function getHandlerUserArr(): array + { + $handlerUserArr = $this->handlerUserArr; + foreach ($handlerUserArr as $key => $value) { + $handlerUserArr[$key] = __service($this->menuTitle . '.' . $value); + } + return $handlerUserArr; + } + + public function allocation($id, $handler_user) + { + try { + DB::beginTransaction(); + + $model = ParkingAlarmInformation::query()->findOrFail($id); + $oldValue = $model->toArray(); + + $model->update([ + 'handler_user' => $handler_user, + 'updated_at' => get_datetime() + ]); + + $this->logService->logUpdated( + $model, + $oldValue, + $this->menuTitle . '.allocation_user' + ); + + DB::commit(); + return $model; + } catch (Exception $e) { + DB::rollBack(); + throw $e; + } + } + + public function editRemark($id, $remark) + { + try { + DB::beginTransaction(); + + $model = ParkingAlarmInformation::query()->findOrFail($id); + $oldValue = $model->toArray(); + + $model->update([ + 'handler_remark' => $remark, + 'updated_at' => get_datetime() + ]); + + $this->logService->logUpdated( + $model, + $oldValue, + $this->menuTitle . '.edit_remark' + ); + + DB::commit(); + return $model; + } catch (Exception $e) { + DB::rollBack(); + throw $e; + } + } +} diff --git a/database/migrations/2026_06_05_143449_create_parking_alarm_information_table.php b/database/migrations/2026_06_05_143449_create_parking_alarm_information_table.php new file mode 100644 index 0000000..e9f6c6b --- /dev/null +++ b/database/migrations/2026_06_05_143449_create_parking_alarm_information_table.php @@ -0,0 +1,38 @@ +id(); + $table->string('varchar', 78)->default('')->comment('报警名称'); + $table->tinyInteger('type')->default(1)->comment('告警大类'); + $table->tinyInteger('notice_type')->default(1)->comment('消息类型'); + $table->tinyInteger('level')->default(1)->comment('消息级别'); + $table->string('condition', 255)->default('')->comment('触发条件'); + $table->string('content', 255)->default('')->comment('消息内容示例'); + $table->string('remark', 255)->default('')->comment('备注'); + $table->integer('handler_user')->nullable()->comment('处理人'); + $table->string('handler_remark', 255)->default('')->comment('处理备注'); + $table->timestamps(); + $table->innoDb(); + $table->comment('告警信息管理'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('parking_alarm_information'); + } +}; diff --git a/database/seeders/AdminConfigSeeder.php b/database/seeders/AdminConfigSeeder.php index c39a35d..9e94c3d 100644 --- a/database/seeders/AdminConfigSeeder.php +++ b/database/seeders/AdminConfigSeeder.php @@ -13,13 +13,38 @@ class AdminConfigSeeder extends Seeder */ public function run(): void { - // - DB::table('admin_configs')->insert($this->data()); + $created_at = date("Y-m-d H:i:s", time()); + // 创建配置数据 + $exists = DB::table('admin_configs')->whereIn( + 'name', + ['parking_lot', 'information_setting'] + )->exists(); + if (!$exists) { + DB::table('admin_configs')->insert($this->data($created_at)); + } + + //创建告警数据 + $exists = DB::table('parking_alarm_information')->where('id', '>=', 1) + ->exists(); + if (!$exists) { + $dataArr = $this->alarmDataArr($created_at); + foreach ($dataArr as $value) { + $translation = $value['translation']; + $name = $value['name']; + unset($value['translation']); + DB::table('parking_alarm_information')->insert($value); + $id = DB::table('parking_alarm_information')->where( + 'name', + $name + )->value('id'); + $this->createTranslation($translation, $value, $id, $created_at); + } + } } - protected function data(): array + // 获取配置信息数据 + protected function data($created_at): array { - $created_at = date("Y-m-d H:i:s", time()); return [ [ 'title' => '车场配置', @@ -69,7 +94,8 @@ class AdminConfigSeeder extends Seeder ]), 'status' => 1, 'created_at' => $created_at - ],[ + ], + [ 'title' => '信息设定', 'name' => 'information_setting', 'content' => json_encode([ @@ -81,4 +107,476 @@ class AdminConfigSeeder extends Seeder ] ]; } + + // 获取告警数据 + protected function alarmDataArr($created_at): array + { + return [ + [ + 'name' => '模式切换', + 'type' => 2, + 'notice_type' => 1, + 'level' => 5, + 'condition' => '运行模式已切换', + 'content' => '运行模式已切换至 [当前模式]。例如:运行模式已切换至「喜马模式」。', + 'remark' => '仅在模式变化时通知;可下载该次切换巡检报告详情。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Mode Switch', '模式切換'], + ['Operating mode has changed', '運行模式已切換'], + [ + 'Operating mode has switched to [Current Mode]. Example: switched to "Event Mode".', + '運行模式已切換至[當前模式]。 例如:運行模式已切換至「喜馬模式」。' + ], + [ + 'Only notifies when the mode changes; the inspection report for this switch can be downloaded.', + '僅在模式變化時通知; 可下載該次切換巡檢報告詳情。' + ] + ] + ], + [ + 'name' => 'VIP 到达', + 'type' => 2, + 'notice_type' => 1, + 'level' => 3, + 'condition' => 'VIP 名单中的车辆到达车位', + 'content' => 'VIP 车辆([车牌号])已到达车位 [车位号]。例如:VIP 车辆(VIP 0233)已到达 2-103 车位。', + 'remark' => '仅 VIP 车辆到达时通知。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['VIP Arrival', 'VIP 到達'], + [ + 'A vehicle on the VIP list has arrived at the parking space', + 'VIP 名單中的車輛到達車位' + ], + [ + 'VIP vehicle ([Plate No.]) has arrived at space [Space No.]. Example: VIP vehicle (VIP 0233) has arrived at space 2-103.', + 'VIP 車輛([車牌號])已到達車位[車位號]。 例如:VIP車輛(VIP 0233)已到達2-103車位。' + ], + [ + 'Only notifies when a VIP vehicle arrives.', + '僅 VIP 車輛到達時通知。' + ] + ] + ], + [ + 'name' => '硬件设备无响应', + 'type' => 1, + 'notice_type' => 2, + 'level' => 2, + 'condition' => '硬件设备无响应', + 'content' => '[设备类型] [设备ID] 无响应。例如:摄像头 001 无响应。', + 'remark' => '设备恢复正常前每 5 分钟展示一次。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Hardware Not Responding', '硬體設備無響應'], + ['Hardware device is not responding', '硬體設備無響應'], + [ + '[Device Type] [Device ID] is not responding. Example: Camera 001 is not responding.', + '[設備類型] [設備ID]無響應。 例如:監視器001無響應。' + ], + [ + 'Displayed every 5 minutes until the device returns to normal.', + '設備恢復正常前每5分鐘展示一次。' + ] + ] + ], + [ + 'name' => '跨线停车', + 'type' => 2, + 'notice_type' => 1, + 'level' => 4, + 'condition' => '车辆已停放但超出车位线', + 'content' => '在 [车位号] 存在跨线停车。例如:在 2-103 存在跨线停车。', + 'remark' => '', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Line-Crossing Parking', '跨線停車'], + [ + 'Vehicle is parked beyond the parking space lines', + '車輛已停放但超出車位線' + ], + [ + 'Line-crossing parking detected at [Space No.]. Example: detected at space 2-103.', + '在[車位號]存在跨線停車。 例如:在2-103存在跨線停車。' + ], + ['', ''] + ] + ], + [ + 'name' => '违规停车', + 'type' => 2, + 'notice_type' => 1, + 'level' => 4, + 'condition' => '车辆停放在错误的车位', + 'content' => '在 [车位号] 存在违规停车。例如:在 2-103 存在违规停车。', + 'remark' => '', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Illegal Parking', '違規停車'], + ['Vehicle is parked in the wrong space', '車輛停放在錯誤的車位'], + [ + 'Illegal parking detected at [Space No.]. Example: detected at space 2-103.', + '在[車位號]存在違規停車。 例如:在2-103存在違規停車。' + ], + ['', ''] + ] + ], + [ + 'name' => '设备故障告警', + 'type' => 1, + 'notice_type' => 2, + 'level' => 2, + 'condition' => '硬件掉线', + 'content' => '[设备类型] [设备ID] 无响应。', + 'remark' => '涵盖道闸、摄像头、余位屏、红绿指示灯、车道诱导屏等;需现场或远程排查。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Device Fault Alarm', '設備故障告警'], + ['Hardware disconnected', '硬體掉線'], + [ + '[Device Type] [Device ID] is not responding.', + '[設備類型] [設備ID]無響應。' + ], + [ + 'Covers barriers, cameras, occupancy displays, signal lights, lane guidance screens, etc.; requires on-site or remote troubleshooting.', + '涵蓋道閘、監視器、餘比特、紅綠指示燈、車道誘導屏等; 需現場或遠程排查。' + ] + ] + ], + [ + 'name' => '车辆重复进场', + 'type' => 1, + 'notice_type' => 1, + 'level' => 2, + 'condition' => '同一车牌入场且无对应出场记录', + 'content' => '车牌 [车牌号] 重复入场,请核对出场记录。', + 'remark' => '需人工确认系统误差或漏扫出场。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Duplicate Entry', '車輛重複進場'], + [ + 'Same plate entered again with no matching exit record', + '同一車牌入場且無對應出場記錄' + ], + [ + 'Plate [Plate No.] has entered repeatedly. Please verify the exit record.', + '車牌[車牌號]重複入場,請核對出場記錄。' + ], + [ + 'Requires manual confirmation of system error or missed exit scan.', + '需人工確認系統誤差或漏掃出場。' + ] + ] + ], + [ + 'name' => '非法闯入/跟车', + 'type' => 1, + 'notice_type' => 1, + 'level' => 1, + 'condition' => '跟车闯关或强行闯入', + 'content' => '车道 [车道编号] 检测到非法闯入或跟车行为。', + 'remark' => '安全与营收风险高,需复核录像与道闸日志。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Illegal Intrusion / Tailgating', '非法闖入/跟車'], + [ + 'Tailgating through the barrier or forced entry', + '跟車闖關或强行闖入' + ], + [ + 'Illegal intrusion or tailgating detected on lane [Lane No.].', + '車道[車道編號]檢測到非法闖入或跟車行為。' + ], + [ + 'High safety and revenue risk; review surveillance footage and barrier logs.', + '安全與營收風險高,需覆核錄影與道閘日誌。' + ] + ] + ], + [ + 'name' => '跨线/违规占用', + 'type' => 1, + 'notice_type' => 1, + 'level' => 3, + 'condition' => '跨线停放、燃油车占充电位、非 VIP 占用专属位等', + 'content' => '车位 [车位号] 存在跨线或违规占用,请派员处理。', + 'remark' => '需巡逻人员联系车主或到场处置。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Line-Crossing / Illegal Occupancy', '跨線/違規佔用'], + [ + 'Line-crossing parking, fuel vehicles occupying charging spaces, non-VIP occupying reserved spaces, etc.', + '跨線停放、燃油車占充電位、非VIP佔用專屬比特等' + ], + [ + 'Line-crossing or illegal occupancy detected at space [Space No.]. Please dispatch staff.', + '車位[車位號]存在跨線或違規佔用,請派員處理。' + ], + [ + 'Patrol staff should contact the owner or handle it on site.', + '需巡邏人員聯系車主或到場處置。' + ] + ] + ], + [ + 'name' => '模式切换告警', + 'type' => 1, + 'notice_type' => 2, + 'level' => 2, + 'condition' => '模式切换时超过 20% 设备未成功切换', + 'content' => '模式切换失败设备占比 [百分比],超过阈值 20%。', + 'remark' => '需核对设备清单与下发日志。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Mode Switch Alarm', '模式切換告警'], + [ + 'More than 20% of devices failed during mode switching', + '模式切換時超過20%設備未成功切換' + ], + [ + 'The proportion of devices that failed to switch mode is [Percentage], exceeding the 20% threshold.', + '模式切換失敗設備占比[百分比],超過閾值20%。' + ], + [ + 'Verify the device list and dispatch logs.', + '需核對設備清單與下發日誌。' + ] + ] + ], + [ + 'name' => '车道拥堵告警', + 'type' => 1, + 'notice_type' => 1, + 'level' => 3, + 'condition' => '车道平均车速低于设定阈值', + 'content' => '车道 [车道编号] 平均车速低于阈值,可能存在拥堵。', + 'remark' => '', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Lane Congestion Alarm', '車道擁堵告警'], + [ + 'Average lane speed is below the configured threshold', + '車道平均車速低於設定閾值' + ], + [ + 'Average speed on lane [Lane No.] is below the threshold. Congestion may exist.', + '車道[車道編號]平均車速低於閾值,可能存在擁堵。' + ], + ['', ''] + ] + ], + [ + 'name' => '碰撞告警', + 'type' => 1, + 'notice_type' => 1, + 'level' => 2, + 'condition' => '场区内检测到疑似车辆碰撞', + 'content' => '区域 [区域] 检测到疑似碰撞事件,请查看监控。', + 'remark' => '', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Collision Alarm', '碰撞告警'], + [ + 'Suspected vehicle collision detected in the area', + '場區內檢測到疑似車輛碰撞' + ], + [ + 'A suspected collision has been detected in area [Area]. Please check the surveillance feed.', + '區域[區域]檢測到疑似碰撞事件,請查看監控。' + ], + ['', ''] + ] + ], + [ + 'name' => '停车超时告警', + 'type' => 1, + 'notice_type' => 1, + 'level' => 3, + 'condition' => '车辆停放超过允许最长时间(如 48 小时)', + 'content' => '车位 [车位号] 停车时长超过 [时长] 小时。', + 'remark' => '用于识别「僵尸车」或漏扫出场。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Overtime Parking Alarm', '停車超時告警'], + [ + 'Vehicle has parked longer than the allowed maximum duration (e.g. 48 hours)', + '車輛停放超過允許最長時間(如48小時)' + ], + [ + 'Parking duration at space [Space No.] has exceeded [Duration] hours.', + '車位[車位號]停車時長超過[時長]小時。' + ], + [ + 'Used to identify long-term parked vehicles or missed exit scans.', + '用於識別「僵屍車」或漏掃出場。' + ] + ] + ], + [ + 'name' => '准入权限拦截', + 'type' => 2, + 'notice_type' => 1, + 'level' => 4, + 'condition' => '非预约/无权限车辆尝试进入管制区域', + 'content' => '车辆 [车牌号] 无准入权限,已自动拦截并记录。', + 'remark' => '系统自动拦截并记日志,一般无需到场。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Access Permission Blocked', '准入許可權攔截'], + [ + 'Unreserved / unauthorized vehicle attempted to enter a controlled area', + '非預約/無許可權車輛嘗試進入管制區域' + ], + [ + 'Vehicle [Plate No.] has no access permission and was automatically blocked and logged.', + '車輛[車牌號]無准入許可權,已自動攔截並記錄。' + ], + [ + 'Automatically blocked and logged by the system; usually no on-site action is required.', + '系統自動攔截並記日誌,一般無需到場。' + ] + ] + ], + [ + 'name' => '运行模式变更', + 'type' => 2, + 'notice_type' => 1, + 'level' => 5, + 'condition' => '系统按日程自动切换运行模式', + 'content' => '系统已自动切换至 [当前模式](如赛事日模式)。', + 'remark' => '', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Operating Mode Changed', '運行模式變更'], + [ + 'System automatically switched operating mode according to the schedule', + '系統按日程自動切換運行模式' + ], + [ + 'The system has automatically switched to [Current Mode] (e.g. Event Day Mode).', + '系統已自動切換至[當前模式](如賽事日模式)。' + ], + ['', ''] + ] + ], + [ + 'name' => 'VIP 到达提醒', + 'type' => 2, + 'notice_type' => 1, + 'level' => 3, + 'condition' => '高等级会员或指定车辆进入', + 'content' => 'VIP 车辆 [车牌号] 已进入,可提供礼宾服务。', + 'remark' => '用于礼宾与接待协同。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['VIP Arrival Reminder', 'VIP 到達提醒'], + [ + 'High-tier member or specified vehicle has entered', + '高等級會員或指定車輛進入' + ], + [ + 'VIP vehicle [Plate No.] has entered. Concierge service can be prepared.', + 'VIP 車輛[車牌號]已進入,可提供禮賓服務。' + ], + [ + 'Used for concierge and reception coordination.', + '用於禮賓與接待協同。' + ] + ] + ], + [ + 'name' => '维修车位定时提醒', + 'type' => 2, + 'notice_type' => 1, + 'level' => 5, + 'condition' => '每日定时汇总', + 'content' => '当前维修中车位共 [数量] 个,明细见附件/报表。', + 'remark' => '', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Maintenance Space Scheduled Reminder', '維修車位定時提醒'], + ['Daily scheduled summary', '每日定時匯總'], + [ + 'There are currently [Count] spaces under maintenance. See the attachment/report for details.', + '當前維修中車位共[數量]個,明細見附件/報表。' + ], + ['', ''] + ] + ], + [ + 'name' => '数据更新', + 'type' => 2, + 'notice_type' => 1, + 'level' => 5, + 'condition' => '模式、车位数、活动、预约等数据发生更新', + 'content' => '数据域 [名称] 已更新,版本 [版本号]。', + 'remark' => '操作审计与变更留痕。', + 'created_at' => $created_at, + 'updated_at' => $created_at, + 'translation' => [ + ['Data Update', '數據更新'], + [ + 'Modes, space counts, activities, reservations, or other data have been updated', + '模式、車位數、活動、預約等數據發生更新' + ], + [ + 'Data domain [Name] has been updated to version [Version].', + '數據域[名稱]已更新,版本[版本號]。' + ], + [ + 'For operation audit and change traceability.', + '操作稽核與變更留痕。' + ] + ] + ] + ]; + } + + // 创建翻译 + protected function createTranslation($translation, $item, $id, $created_at) + { + $values = []; + foreach ($translation as $key => $value) { + if (!empty($value[0])) { + if ($key == 1) { + $zh_cn = $item['condition']; + } elseif ($key == 2) { + $zh_cn = $item['content']; + } elseif ($key == 3) { + $zh_cn = $item['remark']; + } else { + $zh_cn = $item['name']; + } + $values[] = [ + 'en' => $value[0], + 'zh_cn' => $zh_cn, + 'zh_tw' => $value[1], + 'type_id' => $id, + 'type' => '10' . $key, + 'created_at' => $created_at + ]; + } + } + if ($values) { + DB::table('admin_translation')->insert($values); + } + } } diff --git a/database/seeders/AdminMenuSeeder.php b/database/seeders/AdminMenuSeeder.php index ebabfe6..e7216ca 100644 --- a/database/seeders/AdminMenuSeeder.php +++ b/database/seeders/AdminMenuSeeder.php @@ -254,7 +254,9 @@ class AdminMenuSeeder extends Seeder 'uri' => 'alarmInformation', 'page_uri' => '/info/alarmInformation', 'child' => [ - 'read_only' => 'alarmInformation.index' + 'read_only' => 'alarmInformation.index', + 'allocation' => 'alarmInformation.allocation', + 'edit_remark' => 'alarmInformation.edit_remark' ] ], 'abnormal_resource_usage' => [ diff --git a/resources/lang/en/log.php b/resources/lang/en/log.php index d09ed1b..1d8db2a 100644 --- a/resources/lang/en/log.php +++ b/resources/lang/en/log.php @@ -134,5 +134,9 @@ return [ ], 'abnormal_resource_usage' => [ 'operation' => 'Update operation type' + ], + 'alarm_information' => [ + 'allocation_user' => 'Assign handlers', + 'edit_remark' => "Editor's note" ] ]; diff --git a/resources/lang/en/menu.php b/resources/lang/en/menu.php index 8a1a799..2a4b862 100644 --- a/resources/lang/en/menu.php +++ b/resources/lang/en/menu.php @@ -93,5 +93,7 @@ return [ 'batch_parking_repair' => 'Batch import of maintenance parking spaces', 'batch_update_attr' => 'Batch modify attributes', 'abnormal_handle' => 'handle exceptions', - 'abnormal_ignore' => 'Ignore exceptions' + 'abnormal_ignore' => 'Ignore exceptions', + 'allocation' => 'allocation', + 'edit_remark' => "Editor's note", ]; diff --git a/resources/lang/en/service.php b/resources/lang/en/service.php index 1229bb7..ca76a09 100644 --- a/resources/lang/en/service.php +++ b/resources/lang/en/service.php @@ -147,5 +147,20 @@ return [ 'week' => 'the past week', 'month' => 'Last month', 'month3' => 'Last March' + ], + 'alarm_information' => [ + 'scene' => 'On site support is required', + 'notice' => 'Notification', + 'info_notice' => 'information message', + 'support_notice' => 'Support message', + 'urgent' => 'urgent', + 'high' => 'high', + 'middle' => 'middle', + 'low' => 'low', + 'info' => 'information', + 'handler1' => 'Operation duty A', + 'handler2' => 'Operation duty B', + 'handler3' => 'Engineering Maintenance Team', + 'handler4' => 'Security patrol' ] ]; diff --git a/resources/lang/zh-CN/log.php b/resources/lang/zh-CN/log.php index f26b338..4abe13a 100644 --- a/resources/lang/zh-CN/log.php +++ b/resources/lang/zh-CN/log.php @@ -134,5 +134,9 @@ return [ ], 'abnormal_resource_usage' => [ 'operation' => '更新操作类型' + ], + 'alarm_information' => [ + 'allocation_user' => '分配处理人', + 'edit_remark' => '编辑备注' ] ]; diff --git a/resources/lang/zh-CN/menu.php b/resources/lang/zh-CN/menu.php index 0a6a3d9..687ca22 100644 --- a/resources/lang/zh-CN/menu.php +++ b/resources/lang/zh-CN/menu.php @@ -93,5 +93,7 @@ return [ 'batch_parking_repair' => '批量导入维修车位', 'batch_update_attr' => '批量修改属性', 'abnormal_handle' => '处理异常', - 'abnormal_ignore' => '忽略异常' + 'abnormal_ignore' => '忽略异常', + 'allocation' => '分配', + 'edit_remark' => '编辑备注', ]; diff --git a/resources/lang/zh-CN/service.php b/resources/lang/zh-CN/service.php index 50e3dc1..4785dc2 100644 --- a/resources/lang/zh-CN/service.php +++ b/resources/lang/zh-CN/service.php @@ -147,5 +147,20 @@ return [ 'week' => '过去一周', 'month' => '过去一月', 'month3' => '过去三月' + ], + 'alarm_information' => [ + 'scene' => '需现场支持', + 'notice' => '消息通知', + 'info_notice' => '信息消息', + 'support_notice' => '支持消息', + 'urgent' => '紧急', + 'high' => '高', + 'middle' => '中', + 'low' => '低', + 'info' => '信息', + 'handler1' => '运营值班 A', + 'handler2' => '运营值班 B', + 'handler3' => '工程维保组', + 'handler4' => '安保巡逻' ] ]; diff --git a/resources/lang/zh-TW/log.php b/resources/lang/zh-TW/log.php index 8b69b57..4fb1055 100644 --- a/resources/lang/zh-TW/log.php +++ b/resources/lang/zh-TW/log.php @@ -134,5 +134,9 @@ return [ ], 'abnormal_resource_usage' => [ 'operation' => '更新操作類型' + ], + 'alarm_information' => [ + 'allocation_user' => '分配處理人', + 'edit_remark' => '編輯備註' ] ]; diff --git a/resources/lang/zh-TW/menu.php b/resources/lang/zh-TW/menu.php index 7f8c8ac..9543e0e 100644 --- a/resources/lang/zh-TW/menu.php +++ b/resources/lang/zh-TW/menu.php @@ -93,5 +93,7 @@ return [ 'batch_parking_repair' => '批量導入維修車位', 'batch_update_attr' => '批量修改内容', 'abnormal_handle' => '處理异常', - 'abnormal_ignore' => '忽略异常' + 'abnormal_ignore' => '忽略异常', + 'allocation' => '分配', + 'edit_remark' => '編輯備註', ]; diff --git a/resources/lang/zh-TW/service.php b/resources/lang/zh-TW/service.php index ce50c46..966370b 100644 --- a/resources/lang/zh-TW/service.php +++ b/resources/lang/zh-TW/service.php @@ -147,5 +147,20 @@ return [ 'week' => '過去一周', 'month' => '過去一月', 'month3' => '過去三月' + ], + 'alarm_information' => [ + 'scene' => '需現場支持', + 'notice' => '消息通知', + 'info_notice' => '資訊消息', + 'support_notice' => '支持消息', + 'urgent' => '緊急', + 'high' => '高', + 'middle' => '中', + 'low' => '低', + 'info' => '訊息', + 'handler1' => '運營值班 A', + 'handler2' => '運營值班 B', + 'handler3' => '工程維保組', + 'handler4' => '安保巡邏' ] ]; diff --git a/routes/admin/api.php b/routes/admin/api.php index b3738e0..22d0fd4 100644 --- a/routes/admin/api.php +++ b/routes/admin/api.php @@ -38,6 +38,7 @@ use App\Http\Controllers\Admin\ChannelPermissionsController; use App\Http\Controllers\Admin\ParkingEquipmentController; use App\Http\Controllers\Admin\ParkingWhitelistController; use App\Http\Controllers\Admin\ParkingAbnormalController; +use App\Http\Controllers\Admin\ParkingAlarmInformationController; Route::group(['prefix' => 'admin'], function () { @@ -188,6 +189,12 @@ Route::group(['prefix' => 'admin'], function () { Route::post('/notice/setting', [NoticeController::class, 'setting']); Route::get('/notice/show/{id}', [NoticeController::class, 'show']); // 异常占用 + Route::get('/alarmInformation', [ParkingAlarmInformationController::class, 'index']); + Route::get('/alarmInformation/search', [ParkingAlarmInformationController::class, 'search']); + Route::get('/alarmInformation/show/{id}', [ParkingAlarmInformationController::class, 'show']); + Route::post('/alarmInformation/allocation', [ParkingAlarmInformationController::class, 'allocation']); + Route::post('/alarmInformation/editRemark', [ParkingAlarmInformationController::class, 'editRemark']); + // 异常占用 Route::get('/abnormalResourceUsage', [ParkingAbnormalController::class, 'index']); Route::get('/abnormalResourceUsage/search', [ParkingAbnormalController::class, 'search']); Route::post('/abnormalResourceUsage/handle', [ParkingAbnormalController::class, 'handle']);