feat:优化信息

This commit is contained in:
henry
2021-11-25 11:59:50 +08:00
parent bed8653805
commit c6b37755b9

View File

@ -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
}