|
@@ -4,7 +4,6 @@ import (
|
|
|
"fmt"
|
|
|
"git.aionnect.com/aionnect/go-common/utils"
|
|
|
"git.aionnect.com/aionnect/go-common/utils/date"
|
|
|
- "git.aionnect.com/aionnect/go-common/utils/jsonutil"
|
|
|
"git.aionnect.com/aionnect/go-common/utils/logger"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"net/http"
|
|
@@ -69,8 +68,8 @@ func Recovery(hostPrefix string, logger *logger.Logger) gin.HandlerFunc {
|
|
|
}
|
|
|
if i, ok := ctxt.Get(IsLogHTTPResponse); ok {
|
|
|
if isLogHttpResponse, ok := i.(bool); ok && isLogHttpResponse {
|
|
|
- respStr, _ := jsonutil.MarshalToString(res)
|
|
|
- logger = logger.WithField("responseBody", respStr)
|
|
|
+ respData, _ := res.MarshalJSON()
|
|
|
+ logger = logger.WithField("responseBody", string(respData))
|
|
|
}
|
|
|
}
|
|
|
logger.
|
|
@@ -86,8 +85,7 @@ func Recovery(hostPrefix string, logger *logger.Logger) gin.HandlerFunc {
|
|
|
res := utils.E(9999, "未定义", nil)
|
|
|
if i, ok := ctxt.Get(IsLogHTTPResponse); ok {
|
|
|
if isLogHttpResponse, ok := i.(bool); ok && isLogHttpResponse {
|
|
|
- respStr, _ := jsonutil.MarshalToString(res)
|
|
|
- logger = logger.WithField("responseBody", respStr)
|
|
|
+ logger = logger.WithField("responseBody", `{"head":{"errcode":9999,"errmsg":"未定义"}}`)
|
|
|
}
|
|
|
}
|
|
|
logger.
|