fix: 修复一些错误引用
This commit is contained in:
@ -11,11 +11,11 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/trace"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper/op_ternary"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/consts"
|
||||
"git.zhangdeman.cn/zhangdeman/gin/define"
|
||||
"git.zhangdeman.cn/zhangdeman/gin/request/parse_body"
|
||||
"git.zhangdeman.cn/zhangdeman/trace"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper/op_ternary"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
@ -242,33 +242,29 @@ func (wh *wrapperHandle) ParseCookie(ctx *gin.Context) map[string]string {
|
||||
}
|
||||
|
||||
// GetLogicAfterResponse ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 16:54 2025/2/28
|
||||
func (wh *wrapperHandle) GetLogicAfterResponse(ctx *gin.Context) *define.LogicAfterResponse {
|
||||
if nil == ctx || nil == ctx.Request {
|
||||
return nil
|
||||
}
|
||||
l, exist := ctx.Get(define.LogicAfterResponseKey)
|
||||
l, exist := ctx.Get(consts.GinLogicAfterResponseKey)
|
||||
if !exist || nil == l {
|
||||
l = &define.LogicAfterResponse{
|
||||
SuccessHookFuncList: make([]func(), 0),
|
||||
FailureHookFuncList: make([]func(), 0),
|
||||
SuccessHookFuncList: make([]func(ctx *gin.Context), 0),
|
||||
FailureHookFuncList: make([]func(ctx *gin.Context), 0),
|
||||
Lock: &sync.RWMutex{},
|
||||
}
|
||||
ctx.Set(define.LogicAfterResponseKey, l)
|
||||
ctx.Set(consts.GinLogicAfterResponseKey, l)
|
||||
}
|
||||
// 就这么写, key值如果被其他人覆盖成非法值, 此处会直接panic
|
||||
return l.(*define.LogicAfterResponse)
|
||||
}
|
||||
|
||||
// GetCustomContext 获取自定义context
|
||||
func (wh *wrapperHandle) GetCustomContext(ctx *gin.Context) *define.Context {
|
||||
return define.NewContext(ctx)
|
||||
}
|
||||
|
||||
// GetTraceInstance 获取trace实例
|
||||
func (wh *wrapperHandle) GetTraceInstance(ctx *gin.Context) *trace.Runtime {
|
||||
return define.NewContext(ctx).Trace
|
||||
i, exist := ctx.Get(consts.GinTraceInstanceField)
|
||||
if !exist || nil == i {
|
||||
i = trace.NewRuntime(wh.GetCtxStringData(ctx, consts.GinTraceIDField, ""), 2)
|
||||
ctx.Set(consts.GinTraceInstanceField, i)
|
||||
}
|
||||
return i.(*trace.Runtime)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user