feat:优化信息
This commit is contained in:
@ -32,14 +32,22 @@ func NeedLogin(skipperURL ...SkipperURL) gin.HandlerFunc {
|
|||||||
token := c.GetHeader(config.APIRequestToken)
|
token := c.GetHeader(config.APIRequestToken)
|
||||||
|
|
||||||
if token == "" {
|
if token == "" {
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{"message": "Token异常"})
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": http.StatusUnauthorized,
|
||||||
|
"message": "Token异常",
|
||||||
|
})
|
||||||
|
//c.JSON(http.StatusUnauthorized, gin.H{"message": "Token异常"})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session, err := service.NewAuthToken(token).Auth()
|
session, err := service.NewAuthToken(token).Auth()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(http.StatusUnauthorized, gin.H{"message": err.Error()})
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"code": http.StatusUnauthorized,
|
||||||
|
"message": err.Error(),
|
||||||
|
})
|
||||||
|
//c.JSON(http.StatusUnauthorized, gin.H{"message": err.Error()})
|
||||||
c.Abort()
|
c.Abort()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user