feat: 优化 form value

This commit is contained in:
2025-12-28 18:21:44 +08:00
parent 94aaccaa9c
commit 8511f311f8

View File

@@ -47,6 +47,10 @@ func (s *server) getFormInitValue(ctx *gin.Context, uriCfg UriConfig) (any, erro
}).ToFieldList()...)
return nil, err
}
// 非必传参数设置默认值
defaults.SetDefaults(formValue)
return formValue, nil
}
@@ -82,9 +86,6 @@ func (s *server) RequestHandler(uriCfg UriConfig) gin.HandlerFunc {
return
}
// 非必传参数设置默认值
defaults.SetDefaults(formValue)
// 默认请求失败
ctx.Set(consts.GinRequestSuccess, false)
// 初始化响应之后 logic
@@ -156,10 +157,6 @@ func (s *server) SseHandler(uriCfg UriConfig) gin.HandlerFunc {
return
}
// 非必传参数设置默认值
defaults.SetDefaults(formValue)
// 默认请求失败
ctx.Set(consts.GinRequestSuccess, false)
// 初始化响应之后 logic
logicAfterResponse := &define.LogicAfterResponse{