feat:优化信息
This commit is contained in:
@ -32,14 +32,22 @@ func NeedLogin(skipperURL ...SkipperURL) gin.HandlerFunc {
|
||||
token := c.GetHeader(config.APIRequestToken)
|
||||
|
||||
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()
|
||||
return
|
||||
}
|
||||
session, err := service.NewAuthToken(token).Auth()
|
||||
|
||||
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()
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user