From 940d9f327e55b60a1fe313ff992b8fe7a732f31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Thu, 13 Jan 2022 21:59:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=BC=80=E5=A7=8B=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=AE=BE=E7=BD=AE=E4=B8=BA=E6=AF=AB=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gin/middleware/init_request.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gin/middleware/init_request.go b/gin/middleware/init_request.go index f489d01..1824de5 100644 --- a/gin/middleware/init_request.go +++ b/gin/middleware/init_request.go @@ -28,7 +28,7 @@ func InitRequest(startTimeField string, traceIDField string) gin.HandlerFunc { if len(traceIDField) == 0 { traceIDField = "trace_id" } - ctx.Set(startTimeField, time.Now().Unix()) + ctx.Set(startTimeField, time.Now().UnixMilli()) // 设置请求trace_id ctx.Set(traceIDField, commonUtil.GetHostIP()+"-"+ctx.ClientIP()+"-"+time.Now().Format("20060102150405")+"-"+commonUtil.Md5(commonUtil.GenRandomString("", 16))) ctx.Next()