瀏覽代碼

fix:接口数据加密返回的时候,前后加上双引号

Roc 1 年之前
父節點
當前提交
a406c97b33
共有 4 個文件被更改,包括 8 次插入0 次删除
  1. 2 0
      controllers/base_auth.go
  2. 2 0
      controllers/base_common.go
  3. 2 0
      controllers/base_not_auth.go
  4. 2 0
      controllers/base_pc_not_auth.go

+ 2 - 0
controllers/base_auth.go

@@ -162,6 +162,8 @@ func (c *BaseAuthController) JSON(data interface{}, hasIndent bool, coding bool)
 	// 数据加密
 	if services.CheckEncryption() {
 		content = utils.DesBase64Encrypt(content)
+		// get请求时,不加双引号就获取不到数据,不知道什么原因,所以还是在前后加上双引号吧
+		content = []byte(`"` + string(content) + `"`)
 	}
 	return c.Ctx.Output.Body(content)
 }

+ 2 - 0
controllers/base_common.go

@@ -143,6 +143,8 @@ func (c *BaseCommonController) JSON(data interface{}, hasIndent bool, coding boo
 	// 数据加密
 	if services.CheckEncryption() {
 		content = utils.DesBase64Encrypt(content)
+		// get请求时,不加双引号就获取不到数据,不知道什么原因,所以还是在前后加上双引号吧
+		content = []byte(`"` + string(content) + `"`)
 	}
 
 	return c.Ctx.Output.Body(content)

+ 2 - 0
controllers/base_not_auth.go

@@ -132,6 +132,8 @@ func (c *BaseNotAuthController) JSON(data interface{}, hasIndent bool, coding bo
 	// 数据加密
 	if services.CheckEncryption() {
 		content = utils.DesBase64Encrypt(content)
+		// get请求时,不加双引号就获取不到数据,不知道什么原因,所以还是在前后加上双引号吧
+		content = []byte(`"` + string(content) + `"`)
 	}
 	return c.Ctx.Output.Body(content)
 }

+ 2 - 0
controllers/base_pc_not_auth.go

@@ -146,6 +146,8 @@ func (c *BasePcNotAuthController) JSON(data interface{}, hasIndent bool, coding
 	// 数据加密
 	if services.CheckEncryption() {
 		content = utils.DesBase64Encrypt(content)
+		// get请求时,不加双引号就获取不到数据,不知道什么原因,所以还是在前后加上双引号吧
+		content = []byte(`"` + string(content) + `"`)
 	}
 	return c.Ctx.Output.Body(content)
 }