ziwen пре 2 година
родитељ
комит
dfb4e700a4
1 измењених фајлова са 11 додато и 1 уклоњено
  1. 11 1
      controllers/base_auth.go

+ 11 - 1
controllers/base_auth.go

@@ -235,7 +235,17 @@ func (c *BaseAuthController) ServeJSON(encoding ...bool) {
 			go cache.RecordNewLogs(c.SysUser.AdminId, requestBody, string(body), c.SysUser.RealName, c.Ctx.Input.IP(), c.Ctx.Input.URI())
 		}
 	}
-	c.JSON(c.Data["json"], hasIndent, hasEncoding)
+
+	// 数据加密
+	var result interface{}
+	result = c.Data["json"]
+	if utils.RunMode != "debug" {
+		jsonByte, _ := json.Marshal(c.Data["json"])
+		encryptResult := utils.DesBase64Encrypt(jsonByte)
+		result = string(encryptResult)
+	}
+
+	c.JSON(result, hasIndent, hasEncoding)
 }
 
 func (c *BaseAuthController) JSON(data interface{}, hasIndent bool, coding bool) error {