|
@@ -85,6 +85,8 @@ func (c *BaseCommonController) ServeJSON(encoding ...bool) {
|
|
|
|
|
|
func (c *BaseCommonController) 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 {
|
|
@@ -103,11 +105,11 @@ func (c *BaseCommonController) JSON(data interface{}, hasIndent bool, coding boo
|
|
|
requestBody, _ := url.QueryUnescape(string(c.Ctx.Input.RequestBody))
|
|
|
c.logUri(content, requestBody, ip)
|
|
|
// 如果不是debug分支的话,那么需要加密返回
|
|
|
- if utils.RunMode != "debug" {
|
|
|
- content = utils.DesBase64Encrypt(content)
|
|
|
- // get请求时,不加双引号就获取不到数据,不知道什么原因,所以还是在前后加上双引号吧
|
|
|
- content = []byte(`"` + string(content) + `"`)
|
|
|
- }
|
|
|
+ //if utils.RunMode != "debug" {
|
|
|
+ content = utils.DesBase64Encrypt(content, utils.DesKey)
|
|
|
+ // get请求时,不加双引号就获取不到数据,不知道什么原因,所以还是在前后加上双引号吧
|
|
|
+ content = []byte(`"` + string(content) + `"`)
|
|
|
+ //}
|
|
|
if coding {
|
|
|
content = []byte(utils.StringsToJSON(string(content)))
|
|
|
}
|