mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-15 15:30:26 +00:00
chore: pass through error out
This commit is contained in:
@@ -100,7 +100,18 @@ func TokenAuth() func(c *gin.Context) {
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
if !model.CacheIsUserEnabled(token.UserId) {
|
||||
userEnabled, err := model.IsUserEnabled(token.UserId)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{
|
||||
"error": gin.H{
|
||||
"message": err.Error(),
|
||||
"type": "one_api_error",
|
||||
},
|
||||
})
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
if !userEnabled {
|
||||
c.JSON(http.StatusForbidden, gin.H{
|
||||
"error": gin.H{
|
||||
"message": "用户已被封禁",
|
||||
|
Reference in New Issue
Block a user