瀏覽代碼

生产加密

kobe6258 4 月之前
父節點
當前提交
c811648b94
共有 1 個文件被更改,包括 4 次插入3 次删除
  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 {