fix organize trigger task flow

This commit is contained in:
ShukeBta
2026-06-13 17:08:56 +08:00
parent 4e0929bbca
commit 5f42836bbf
15 changed files with 312 additions and 39 deletions
+2 -3
View File
@@ -159,11 +159,10 @@ func schemaHandler(_ *service.Container) gin.HandlerFunc {
// schedulerTriggerHandler is the alternate path for /admin/scheduler/:name/run.
func schedulerTriggerHandler(svc *service.Container) gin.HandlerFunc {
return func(c *gin.Context) {
if err := svc.Scheduler.RunNow(c.Request.Context(), c.Param("name")); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
if !triggerSchedulerJob(c, svc, c.Param("name")) {
return
}
c.JSON(http.StatusOK, gin.H{"ok": true})
c.JSON(http.StatusAccepted, gin.H{"ok": true, "message": "任务已在后台触发"})
}
}