优化代码组织

This commit is contained in:
2025-02-28 16:53:02 +08:00
parent b95d464c89
commit 9decd12ee8
3 changed files with 25 additions and 23 deletions

View File

@ -9,6 +9,7 @@ package router
import (
"git.zhangdeman.cn/zhangdeman/exception"
"git.zhangdeman.cn/zhangdeman/gin/define"
"git.zhangdeman.cn/zhangdeman/gin/request"
"git.zhangdeman.cn/zhangdeman/gin/response"
"github.com/gin-gonic/gin"
@ -47,13 +48,13 @@ func RequestHandler(uriCfg UriConfig) gin.HandlerFunc {
}
// 初始化响应之后logic
logicAfterResponse := &LogicAfterResponse{
logicAfterResponse := &define.LogicAfterResponse{
SuccessHookFuncList: make([]func(), 0),
FailureHookFuncList: make([]func(), 0),
Lock: &sync.RWMutex{},
}
// 此处暴露出去,是为了使用方可以获取到对应数据
ctx.Set(LogicAfterResponseKey, logicAfterResponse)
ctx.Set(define.LogicAfterResponseKey, logicAfterResponse)
// 执行逻辑
inputValue := reflect.ValueOf(formValue)