feat: 新增壳子内置定时任务功能,支持配置备份与恢复

本次提交新增完整的定时任务系统:
1. 后端支持cron表达式调度插件执行,与手动运行共用执行链路
2. 前端新增定时任务管理页面,支持增删改查与启停操作
3. 实现配置自动备份到中心机,启动时自动从云端恢复任务
4. 配套新增数据库表与控制面API接口
5. 同时优化了考勤异常检查的规则细节
This commit is contained in:
2026-09-19 12:11:49 +08:00
parent 530cfe38dc
commit 600379933d
16 changed files with 1816 additions and 129 deletions
+29
View File
@@ -69,6 +69,35 @@ export async function getRun(runId) {
return j(`/api/runs/${runId}`)
}
// ===== 定时任务(壳子内置定时,配置自动备份中心机) =====
export async function listSchedules() {
return j('/api/schedules')
}
export async function createSchedule(body) {
return j('/api/schedules', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
})
}
export async function updateSchedule(sid, body) {
return j(`/api/schedules/${sid}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
})
}
export async function deleteSchedule(sid) {
return j(`/api/schedules/${sid}`, { method: 'DELETE' })
}
export async function toggleSchedule(sid, enabled) {
return j(`/api/schedules/${sid}/toggle`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ enabled }),
})
}
export function connectWS(onEvent) {
const ws = new WebSocket(WS_BASE + '/ws')
ws.onmessage = (e) => {