停车场管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

582 lines
26 KiB

<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class AdminConfigSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$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($created_at): array
{
return [
[
'title' => '车场配置',
'name' => 'parking_lot',
'content' => json_encode([
[
'name' => 'parking_lot_id',
'value' => 666
],
[
'name' => 'parking_lot_sum',
'value' => 1000
],
[
'name' => 'parking_lot_image_path',
'value' => '/home/wwwroot/test/saas-8'
],
[
'name' => 'zombie_car_parking_duration',
'value' => 10
],
[
'name' => 'numberplate_fuzzy_search',
'value' => 1
],
[
'name' => 'automatically_clear_photo_cycle',
'value' => 10
],
[
'name' => 'report_data_switch',
'value' => 1
],
[
'name' => 'third_parking_lot_id',
'value' => 666
],
[
'name' => 'report_api_url',
'value' => 'https://xg-saas-8.icecloud-car.cc'
],
[
'name' => 'report_cycle',
'value' => 60
],
]),
'status' => 1,
'created_at' => $created_at
],
[
'title' => '信息设定',
'name' => 'information_setting',
'content' => json_encode([
'close_alert' => 0,
'close_all_alert' => 0
]),
'status' => 1,
'created_at' => $created_at
]
];
}
// 获取告警数据
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);
}
}
}