Ver código fonte

生产加密

kobe6258 4 meses atrás
pai
commit
c811648b94
1 arquivos alterados com 4 adições e 3 exclusões
  1. 4 3
      middleware/auth_middleware.go

+ 4 - 3
middleware/auth_middleware.go

@@ -91,10 +91,11 @@ func encoding(data interface{}) interface{} {
 		logger.Error("json 序列化失败", err)
 		return data
 	}
-	if htConfig.NeedEncode() {
-		content = authUtils.DesBase64Encrypt(content, htConfig.GetDesCode())
-		content = []byte(`"` + string(content) + `"`)
+	if !htConfig.NeedEncode() {
+		return data
 	}
+	content = authUtils.DesBase64Encrypt(content, htConfig.GetDesCode())
+	content = []byte(`"` + string(content) + `"`)
 	return content
 }
 func AuthMiddleware() web.FilterFunc {