From 97a48e5267d4ec843bdf6c681e18ab30e7783e18 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Wed, 14 Jul 2021 10:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E8=BD=AC=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/api_controller.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/controllers/api_controller.go b/controllers/api_controller.go index 9b848be38..0179423ee 100644 --- a/controllers/api_controller.go +++ b/controllers/api_controller.go @@ -1,6 +1,7 @@ package controllers import ( + "bytes" "crypto/md5" "encoding/json" "fmt" @@ -374,8 +375,11 @@ func (c *ApiController) GetPrintMsg(dataMap map[string]interface{}) (data, errCo } else if printMsg == nil { return "", model.ErrCodeGeneralFailed, fmt.Errorf("未查询到该消息! msg_id: %v", msgID) } else { - if byteData, err := json.Marshal(printMsg); err == nil { - data = string(byteData) + bf := bytes.NewBuffer([]byte{}) + jsonEncoder := json.NewEncoder(bf) + jsonEncoder.SetEscapeHTML(false) + if err2 := jsonEncoder.Encode(printMsg); err2 == nil { + data = bf.String() } else { return "", model.ErrCodeGeneralFailed, err }