|
@@ -1,8 +1,6 @@ |
|
|
package e |
|
|
package e |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"applet/app/utils" |
|
|
|
|
|
"encoding/json" |
|
|
|
|
|
"net/http" |
|
|
"net/http" |
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
@@ -34,13 +32,8 @@ func OutSuc(c *gin.Context, data interface{}, fields map[string]interface{}) { |
|
|
res[k] = v |
|
|
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{}) { |
|
|
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{}{}, |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 重定向 |
|
|
// 重定向 |
|
|