diff --git a/go.mod b/go.mod index 1493549..611ffe2 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( git.zhangdeman.cn/zhangdeman/exception v0.0.0-20230609101214-16920b714d94 - git.zhangdeman.cn/zhangdeman/util v0.0.0-20230811070456-d6a489d5860b + git.zhangdeman.cn/zhangdeman/util v0.0.0-20230815042559-b34984be7444 github.com/gin-gonic/gin v1.9.1 github.com/go-playground/validator/v10 v10.15.0 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 3d153a8..5c016a7 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +18,8 @@ git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810063945-842592611562 h1:wo0r4mex git.zhangdeman.cn/zhangdeman/util v0.0.0-20230810063945-842592611562/go.mod h1:trYFOShINaQBvinQrH4A0G2kfL22Y2lygEcAiGDt/sc= git.zhangdeman.cn/zhangdeman/util v0.0.0-20230811070456-d6a489d5860b h1:vnmxYrNdX6f5sEVjjkM1fIR+i32kHJ4g9DJqug9KKek= git.zhangdeman.cn/zhangdeman/util v0.0.0-20230811070456-d6a489d5860b/go.mod h1:Yum5+tgP+Wf1GWUAyQz1Qh8Ab9m5+90GYkYdzqVs0lA= +git.zhangdeman.cn/zhangdeman/util v0.0.0-20230815042559-b34984be7444 h1:JVp575weLUX4sfhgjjxotJPxfHio7Ua8KHH3LMRRs2E= +git.zhangdeman.cn/zhangdeman/util v0.0.0-20230815042559-b34984be7444/go.mod h1:IqS3vAMyt1fVCWS7RqGeUw1EFnL/ruUMha45G2T+YNM= git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20230810031624-94c86f913f9c h1:n7lws3x/eR4DlcubTMepiLEgJikSN22sHYqJRaYWIkg= git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20230810031624-94c86f913f9c/go.mod h1:pL3BbQdogtClFCrsiAyzBIQRWKSSIf3v2GuzZu6dGWY= git.zhangdeman.cn/zhangdeman/wrapper v0.0.0-20230811071513-cfc46e8d82e1 h1:k2iu9KgRxeroytB+N+/XapAxt1di7o2pNTISjFlYDJ8= diff --git a/middleware/init_request.go b/middleware/init_request.go index 7f02114..0b12a34 100644 --- a/middleware/init_request.go +++ b/middleware/init_request.go @@ -9,10 +9,11 @@ package middleware import ( "fmt" - "git.zhangdeman.cn/zhangdeman/wrapper" "strings" "time" + "git.zhangdeman.cn/zhangdeman/wrapper" + "git.zhangdeman.cn/zhangdeman/gin/define" networkUtil "git.zhangdeman.cn/zhangdeman/network/util" @@ -46,7 +47,7 @@ func getTraceID(ctx *gin.Context) string { time.Now().UnixNano()/1e6, strings.ReplaceAll(networkUtil.IP.GetHostIP(), ".", ""), strings.ReplaceAll(networkUtil.IP.GetRemoteIP(ctx.Request), ".", ""), - wrapper.StringFromRandom(32, "").Md5(), + wrapper.StringFromRandom(32, "").Md5().Value, ) }