From 319ea1a194435c0cb1e17afa12766298cfcbd0b2 Mon Sep 17 00:00:00 2001 From: QM303176530 <303176530@qq.com> Date: Sun, 22 Nov 2020 23:19:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E9=97=B4=E4=BB=B6=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=BA=8C=E8=BF=9B=E5=88=B6=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/middleware/operation.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/middleware/operation.go b/server/middleware/operation.go index 41bcb883..3c4ea2b6 100644 --- a/server/middleware/operation.go +++ b/server/middleware/operation.go @@ -11,7 +11,6 @@ import ( "io/ioutil" "net/http" "strconv" - "strings" "time" ) @@ -31,7 +30,7 @@ func OperationRecord() gin.HandlerFunc { if claims, ok := c.Get("claims"); ok { waitUse := claims.(*request.CustomClaims) userId = int(waitUse.ID) - }else { + } else { id, err := strconv.Atoi(c.Request.Header.Get("x-user-id")) if err != nil { userId = 0 @@ -46,10 +45,11 @@ func OperationRecord() gin.HandlerFunc { Body: string(body), UserID: userId, } - values := c.Request.Header.Values("content-type") - if len(values) >0 && strings.Contains(values[0], "boundary") { - record.Body = "file" - } + // 存在某些未知错误 TODO + //values := c.Request.Header.Values("content-type") + //if len(values) >0 && strings.Contains(values[0], "boundary") { + // record.Body = "file" + //} writer := responseBodyWriter{ ResponseWriter: c.Writer, body: &bytes.Buffer{},