|
@@ -227,6 +227,8 @@ func (c *BaseAuthController) ServeJSON(encoding ...bool) {
|
|
|
|
|
|
func (c *BaseAuthController) JSON(data interface{}, hasIndent bool, coding bool) error {
|
|
|
c.Ctx.Output.Header("Content-Type", "application/json; charset=utf-8")
|
|
|
+ desEncrypt := utils.DesBase64Encrypt([]byte(utils.DesKey), utils.DesKeySalt)
|
|
|
+ c.Ctx.Output.Header("Dk", string(desEncrypt)) // des3加解密key
|
|
|
var content []byte
|
|
|
var err error
|
|
|
if hasIndent {
|
|
@@ -253,7 +255,7 @@ func (c *BaseAuthController) JSON(data interface{}, hasIndent bool, coding bool)
|
|
|
|
|
|
// 如果不是debug分支的话,那么需要加密返回
|
|
|
if utils.RunMode != "debug" {
|
|
|
- content = utils.DesBase64Encrypt(content)
|
|
|
+ content = utils.DesBase64Encrypt(content, utils.DesKey)
|
|
|
// get请求时,不加双引号就获取不到数据,不知道什么原因,所以还是在前后加上双引号吧
|
|
|
content = []byte(`"` + string(content) + `"`)
|
|
|
}
|