feat: 完成代码逻辑错误修复和任务清理系统实现
主要更新: - 修复了所有主要的代码逻辑错误 - 实现了完整的任务清理系统 - 添加了系统设置页面的任务清理管理功能 - 修复了API调用认证问题 - 优化了密码加密和验证机制 - 统一了错误处理模式 - 添加了详细的文档和测试工具 新增功能: - 任务清理管理界面 - 任务归档和清理日志 - API监控和诊断工具 - 完整的测试套件 技术改进: - 修复了Repository方法调用错误 - 统一了模型方法调用 - 改进了类型安全性 - 优化了代码结构和可维护性
This commit is contained in:
87
demo/frontend/src/api/cleanup.js
Normal file
87
demo/frontend/src/api/cleanup.js
Normal file
@@ -0,0 +1,87 @@
|
||||
// 任务清理API服务
|
||||
import request from './request'
|
||||
|
||||
export const cleanupApi = {
|
||||
// 获取清理统计信息
|
||||
getCleanupStats() {
|
||||
return request({
|
||||
url: '/api/cleanup/cleanup-stats',
|
||||
method: 'GET'
|
||||
})
|
||||
},
|
||||
|
||||
// 执行完整清理
|
||||
performFullCleanup() {
|
||||
return request({
|
||||
url: '/api/cleanup/full-cleanup',
|
||||
method: 'POST'
|
||||
})
|
||||
},
|
||||
|
||||
// 清理指定用户任务
|
||||
cleanupUserTasks(username) {
|
||||
return request({
|
||||
url: `/api/cleanup/user-tasks/${username}`,
|
||||
method: 'POST'
|
||||
})
|
||||
},
|
||||
|
||||
// 获取清理统计信息(原始fetch方式,用于测试)
|
||||
async getCleanupStatsRaw() {
|
||||
try {
|
||||
const response = await fetch('/api/cleanup/cleanup-stats')
|
||||
if (response.ok) {
|
||||
return await response.json()
|
||||
} else {
|
||||
throw new Error('获取统计信息失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取统计信息失败:', error)
|
||||
throw error
|
||||
}
|
||||
},
|
||||
|
||||
// 执行完整清理(原始fetch方式,用于测试)
|
||||
async performFullCleanupRaw() {
|
||||
try {
|
||||
const response = await fetch('/api/cleanup/full-cleanup', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
|
||||
if (response.ok) {
|
||||
return await response.json()
|
||||
} else {
|
||||
throw new Error('执行完整清理失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('执行完整清理失败:', error)
|
||||
throw error
|
||||
}
|
||||
},
|
||||
|
||||
// 清理指定用户任务(原始fetch方式,用于测试)
|
||||
async cleanupUserTasksRaw(username) {
|
||||
try {
|
||||
const response = await fetch(`/api/cleanup/user-tasks/${username}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
|
||||
if (response.ok) {
|
||||
return await response.json()
|
||||
} else {
|
||||
throw new Error('清理用户任务失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('清理用户任务失败:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default cleanupApi
|
||||
Reference in New Issue
Block a user