|
@@ -2,8 +2,10 @@ package response
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "fmt"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"hongze/hongze_yb/global"
|
|
|
+ "strings"
|
|
|
)
|
|
|
|
|
|
var (
|
|
@@ -22,7 +24,18 @@ type ResultData struct {
|
|
|
|
|
|
func result(code int, resultData ResultData, c *gin.Context) {
|
|
|
jsonByte, _ := json.Marshal(resultData)
|
|
|
- global.LOG.Debug("resultData:", string(jsonByte))
|
|
|
+ token := c.Request.Header.Get("Authorization")
|
|
|
+ if token == "" {
|
|
|
+ token = c.DefaultQuery("authorization", "")
|
|
|
+ if token == "" {
|
|
|
+ token = c.DefaultQuery("Authorization", "")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logSlice := make([]string, 0)
|
|
|
+ logSlice = append(logSlice, fmt.Sprint("Url:", c.Request.RequestURI))
|
|
|
+ logSlice = append(logSlice, fmt.Sprint("Token:", token))
|
|
|
+ logSlice = append(logSlice, fmt.Sprint("resultData:", string(jsonByte)))
|
|
|
+ global.LOG.Info(strings.Join(logSlice, "\n"))
|
|
|
|
|
|
//测试环境,数据不进行加密
|
|
|
/*if global.CONFIG.Serve.RunMode == "debug" {
|