Browse Source

更新

three
huangjiajun 10 months ago
parent
commit
e6954fc5d8
1 changed files with 8 additions and 28 deletions
  1. +8
    -28
      app/e/msg.go

+ 8
- 28
app/e/msg.go View File

@@ -1,8 +1,6 @@
package e

import (
"applet/app/utils"
"encoding/json"
"net/http"

"github.com/gin-gonic/gin"
@@ -34,13 +32,8 @@ func OutSuc(c *gin.Context, data interface{}, fields map[string]interface{}) {
res[k] = v
}
}
if utils.GetApiVersion(c) > 0 { //加了签名校验只返回加密的字符串
jsonData, _ := json.Marshal(res)
str := utils.ResultAes(c, jsonData)
c.Writer.WriteString(str)
} else {
c.AbortWithStatusJSON(200, res)
}

c.AbortWithStatusJSON(200, res)
}

func OutSucPure(c *gin.Context, data interface{}, fields map[string]interface{}) {
@@ -79,25 +72,12 @@ func OutErr(c *gin.Context, code int, err ...interface{}) {
}
}
}
if utils.GetApiVersion(c) > 0 { //加了签名校验只返回加密的字符串
jsonData, _ := json.Marshal(gin.H{
"code": code,
"msg": msg,
"data": []struct{}{},
})
str := utils.ResultAes(c, jsonData)
if code > 100000 {
code = int(utils.FloatFormat(float64(code/1000), 0))
}
c.Status(500)
c.Writer.WriteString(str)
} else {
c.AbortWithStatusJSON(statusCode, gin.H{
"code": code,
"msg": msg,
"data": []struct{}{},
})
}

c.AbortWithStatusJSON(statusCode, gin.H{
"code": code,
"msg": msg,
"data": []struct{}{},
})
}

// 重定向


Loading…
Cancel
Save