getKey(); $task = CleanupTask::with('logs')->find($taskId); if (!$task) { return $this->response() ->error('任务不存在'); } $logs = $task->logs()->orderBy('created_at', 'desc')->get(); if ($logs->isEmpty()) { return $this->response() ->info('该任务暂无执行日志'); } $html = '
| 表名 | 清理类型 | 删除前 | 删除后 | 删除数量 | 执行时间 | 状态 | 执行时间 |
|---|---|---|---|---|---|---|---|
| {$log->table_name} | "; $html .= "{$cleanupType} | "; $html .= "" . number_format($log->before_count) . " | "; $html .= "" . number_format($log->after_count) . " | "; $html .= "" . number_format($log->deleted_records) . " | "; $html .= "" . number_format($log->execution_time, 3) . "s | "; $html .= "{$status} | "; $html .= "{$log->created_at} | "; $html .= "
| 错误:{$log->error_message} | "; $html .= "|||||||