新增备份监控与定时配置

This commit is contained in:
yml2213
2026-08-16 23:53:50 +08:00
parent 66cb03ebce
commit f67ee12d72
19 changed files with 612 additions and 3 deletions
@@ -110,6 +110,34 @@ func (h *Handler) Update(c *gin.Context) {
response.OK(c, item)
}
func (h *Handler) BackupSchedule(c *gin.Context) {
schedule, err := h.service.BackupSchedule(c.Request.Context())
if err != nil {
writeConfigError(c, err)
return
}
response.OK(c, schedule)
}
func (h *Handler) UpdateBackupSchedule(c *gin.Context) {
adminID, ok := currentAdminID(c)
if !ok {
response.Unauthorized(c, "缺少管理员上下文")
return
}
var req BackupScheduleDTO
if err := c.ShouldBindJSON(&req); err != nil {
response.BadRequest(c, "备份定时配置格式无效")
return
}
schedule, err := h.service.UpdateBackupSchedule(c.Request.Context(), adminID, req, auditMeta(c))
if err != nil {
writeConfigError(c, err)
return
}
response.OK(c, schedule)
}
func auditMeta(c *gin.Context) AuditMeta {
return AuditMeta{
IP: c.ClientIP(),