优化结构

This commit is contained in:
Yvan
2026-08-27 19:08:51 +08:00
parent 653414a1da
commit 5052835fcb
11 changed files with 197 additions and 19 deletions
+11
View File
@@ -1,8 +1,11 @@
package handler
import (
"errors"
"kra/internal/biz/system"
"kra/internal/service"
"kra/internal/service/dto"
"log/slog"
"github.com/gin-gonic/gin"
)
@@ -63,6 +66,14 @@ func (h *SystemConfig) Set(c *gin.Context) {
func (h *SystemConfig) Reload(c *gin.Context) {
if err := h.system.ReloadConfig(c.Request.Context()); err != nil {
// Reloading the data/configuration is committed before task schedules are
// rebuilt. Match GVA's successful HTTP contract for this partial-success
// case while leaving the typed error available to internal callers.
if errors.Is(err, system.ErrTaskRuntimeReload) {
slog.ErrorContext(c.Request.Context(), "系统配置重载完成,但定时任务恢复失败", "mod", "timedTask", "error", err)
Write(c, CodeSuccess, gin.H{}, "重载系统成功")
return
}
Fail(c, "重载系统失败:"+err.Error())
return
}