getKey(); // 调用预览服务 $result = CleanupService::previewPlan($planId); if (!$result['success']) { return $this->response() ->error('预览失败:' . $result['message']); } $data = $result['data']; $html = '
'; $html .= '
'; $html .= '
总体统计
'; $html .= ''; $html .= '
'; $html .= '
'; $html .= '
风险评估
'; $html .= ''; $html .= '
'; $html .= '
'; if (!empty($data['warnings'])) { $html .= '
'; $html .= '
⚠️ 注意事项:
'; $html .= ''; $html .= '
'; } if (!empty($data['high_risk_tables'])) { $html .= '
'; $html .= '
🔴 高风险表:
'; $html .= '
'; $html .= ''; $html .= ''; $html .= ''; foreach ($data['high_risk_tables'] as $table) { $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= '
表名当前记录数预计删除删除比例
' . $table['table_name'] . '' . number_format($table['current_count']) . '' . number_format($table['estimated_delete']) . '' . $table['delete_percentage'] . '%
'; $html .= '
'; $html .= '
'; } return $this->response() ->success('预览完成') ->detail($html); } catch (\Exception $e) { return $this->response() ->error('预览失败:' . $e->getMessage()); } } /** * 确认对话框 */ public function confirm() { return [ '确认预览计划?', '此操作将分析计划的执行效果,不会实际删除数据。' ]; } }