sys_jwt_blacklist.go 500 B

12345678910111213141516171819202122
  1. package system
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "lcfns/model/common/response"
  6. "lcfns/model/system"
  7. )
  8. type JwtApi struct{}
  9. func (j *JwtApi) JsonInBlacklist(c *gin.Context) {
  10. token := c.Request.Header.Get("x-token")
  11. jwt := system.JwtBlacklist{Jwt: token}
  12. err := jwtService.JsonInBlacklist(jwt)
  13. if err != nil {
  14. logrus.Error("jwt作废失败!", err)
  15. response.FailWithMessage("jwt作废失败", c)
  16. return
  17. }
  18. response.OkWithMessage("jwt作废成功", c)
  19. }