getKey(); $plan = CleanupPlan::with('contents')->find($planId); if (!$plan) { return $this->response() ->error('计划不存在'); } $contents = $plan->contents; if ($contents->isEmpty()) { return $this->response() ->info('该计划暂无内容'); } $html = '
'; $html .= ''; $html .= ''; $cleanupTypes = [ 1 => '清空表', 2 => '删除所有', 3 => '按时间删除', 4 => '按用户删除', 5 => '按条件删除', ]; foreach ($contents as $content) { $cleanupType = $cleanupTypes[$content->cleanup_type] ?? '未知'; $enabled = $content->is_enabled ? '启用' : '禁用'; $backup = $content->backup_enabled ? '' : ''; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; $html .= ""; } $html .= '
表名清理类型优先级批处理大小启用状态备份
{$content->table_name}{$cleanupType}{$content->priority}" . number_format($content->batch_size) . "{$enabled}{$backup}
'; return $this->response() ->success('计划内容') ->detail($html); } catch (\Exception $e) { return $this->response() ->error('查看失败:' . $e->getMessage()); } } /** * 渲染按钮 */ public function render() { return << {$this->title} HTML; } }