user_id = $admin_user_id; } public function model(array $row) { if ($this->index == 1) { $this->index += 1; return; } $space_number = $row[1]; if (empty($space_number)) { return; } $floor_name = $row[2]; if (empty($floor_name)) { return; } $parking_name = $row[3]; if (empty($parking_name)) { return; } $start_at = $row[4]; $start_times = strtotime($start_at); if (empty($start_at) || !$start_times) { return; } $end_at = $row[5]; $end_times = strtotime($end_at); if (empty($end_at) || !$end_times) { return; } if ($start_times >= $end_times) { return; } $space_id = ParkingSpace::getValueId($space_number); if (empty($space_id)) { return; } $service = new ParkingSpaceRepairService(new OperationLogService()); $service->createModel([ 'admin_user_id' => $this->user_id, 'parking_space_name' => $space_number, 'start_at' => date("Y-m-d H:i:s", $start_times), 'end_at' => date("Y-m-d H:i:s", $end_times) ]); } public function chunkSize(): int { return 1000; // 设置每次处理的行数,有助于避免内存问题并可能改善表头解析 } }