From 981e992f28bb62eb59f976f4dde2ea6ba65275d7 Mon Sep 17 00:00:00 2001 From: linwenxiang <991154416@qq.com> Date: Fri, 5 Feb 2021 10:30:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=85=A8=E5=A4=9A=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/utils.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/utils.go b/tools/utils.go index 9eafa6d5..13823a18 100644 --- a/tools/utils.go +++ b/tools/utils.go @@ -8,6 +8,7 @@ import ( "strconv" "github.com/gin-gonic/gin" + "github.com/google/uuid" "golang.org/x/crypto/bcrypt" "gorm.io/gorm" ) @@ -58,6 +59,7 @@ func HasError(err error, msg string, code ...int) { func GenerateMsgIDFromContext(c *gin.Context) string { requestId := c.GetHeader(TrafficKey) if requestId == "" { + requestId = uuid.New().String() c.Header(TrafficKey, requestId) } return requestId