| | |
| | | outUserM[userId] = userId |
| | | } |
| | | |
| | | func OutUser(userId string) bool { |
| | | lock.Lock() |
| | | defer lock.Unlock() |
| | | if _,ok := outUserM[userId];ok{ |
| | | return true |
| | | } |
| | | return false |
| | | } |
| | | |
| | | func RemoveOutUser(userId string) { |
| | | lock.Lock() |
| | | defer lock.Unlock() |
| | |
| | | util.ResponseFormat(c,code.TokenNotFound,"尚未登录,请登录") |
| | | c.Abort() |
| | | } |
| | | user := (*jwtDriver).User(c) |
| | | loginM := user.(map[string]interface{}) |
| | | userId := loginM["id"].(string) |
| | | if OutUser(userId) { |
| | | util.ResponseFormat(c,code.TokenNotFound,"尚未登录,请登录") |
| | | c.Abort() |
| | | } |
| | | c.Next() |
| | | } else { |
| | | c.Next() |