fix
This commit is contained in:
@@ -38,7 +38,7 @@ func (h *Task) Create(c *gin.Context) {
|
||||
httpx.Fail(c, "调度失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OK(c)
|
||||
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "创建成功")
|
||||
}
|
||||
|
||||
func (h *Task) Update(c *gin.Context) {
|
||||
@@ -55,7 +55,7 @@ func (h *Task) Update(c *gin.Context) {
|
||||
httpx.Fail(c, "调度失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OK(c)
|
||||
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "更新成功")
|
||||
}
|
||||
|
||||
func (h *Task) Delete(c *gin.Context) {
|
||||
@@ -69,7 +69,7 @@ func (h *Task) Delete(c *gin.Context) {
|
||||
httpx.Fail(c, "删除失败")
|
||||
return
|
||||
}
|
||||
httpx.OK(c)
|
||||
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "删除成功")
|
||||
}
|
||||
|
||||
func (h *Task) Toggle(c *gin.Context) {
|
||||
@@ -79,14 +79,14 @@ func (h *Task) Toggle(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if err := h.service.Toggle(c.Request.Context(), req.ID, req.Enabled); err != nil {
|
||||
httpx.Fail(c, "设置失败")
|
||||
httpx.Fail(c, "操作失败: "+err.Error())
|
||||
return
|
||||
}
|
||||
if err := h.scheduler.ScheduleID(c.Request.Context(), req.ID); err != nil {
|
||||
httpx.Fail(c, "调度失败")
|
||||
httpx.Fail(c, "操作失败: "+err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OK(c)
|
||||
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "操作成功")
|
||||
}
|
||||
|
||||
func (h *Task) Trigger(c *gin.Context) {
|
||||
@@ -96,10 +96,10 @@ func (h *Task) Trigger(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if err := h.scheduler.TriggerID(c.Request.Context(), req.ID); err != nil {
|
||||
httpx.Fail(c, "任务不存在")
|
||||
httpx.Fail(c, "触发失败: "+err.Error())
|
||||
return
|
||||
}
|
||||
httpx.OK(c)
|
||||
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "已触发, 执行结果见执行日志")
|
||||
}
|
||||
|
||||
func (h *Task) List(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user