fix: align admin behavior and Kratos integrations

This commit is contained in:
2026-08-14 14:14:51 +08:00
parent 8c4c6ba661
commit e0b0e1d8c8
123 changed files with 4334 additions and 1877 deletions
+6 -4
View File
@@ -103,8 +103,8 @@ func (h *Task) Trigger(c *gin.Context) {
}
func (h *Task) List(c *gin.Context) {
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
size, _ := strconv.Atoi(c.DefaultQuery("pageSize", "10"))
page, _ := strconv.Atoi(c.Query("page"))
size, _ := strconv.Atoi(c.Query("pageSize"))
var enabled *bool
if raw := c.Query("enabled"); raw != "" {
value, _ := strconv.ParseBool(raw)
@@ -119,8 +119,8 @@ func (h *Task) List(c *gin.Context) {
}
func (h *Task) Logs(c *gin.Context) {
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
size, _ := strconv.Atoi(c.DefaultQuery("pageSize", "10"))
page, _ := strconv.Atoi(c.Query("page"))
size, _ := strconv.Atoi(c.Query("pageSize"))
taskID, _ := strconv.ParseUint(c.Query("taskId"), 10, 64)
items, total, err := h.service.Logs(c.Request.Context(), page, size, uint(taskID), c.Query("status"))
if err != nil {
@@ -144,6 +144,8 @@ func (h *Task) AlertStream(c *gin.Context) {
httpx.Fail(c, "SSE 不受支持")
return
}
// Remove the normal server deadline for long-lived SSE connections.
_ = http.NewResponseController(c.Writer).SetWriteDeadline(time.Time{})
events := h.scheduler.Subscribe()
defer h.scheduler.Unsubscribe(events)
ticker := time.NewTicker(20 * time.Second)