You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
714 B

  1. package v1
  2. import (
  3. "fmt"
  4. "gin-vue-admin/global/response"
  5. "gin-vue-admin/model"
  6. "github.com/gin-gonic/gin"
  7. )
  8. // @Tags jwt
  9. // @Summary jwt加入黑名单
  10. // @Security ApiKeyAuth
  11. // @accept application/json
  12. // @Produce application/json
  13. // @Success 200 {string} string "{"success":true,"data":{},"msg":"拉黑成功"}"
  14. // @Router /jwt/jsonInBlacklist [post]
  15. func JsonInBlacklist(c *gin.Context) {
  16. token := c.Request.Header.Get("x-token")
  17. ModelJwt := model.JwtBlacklist{
  18. Jwt: token,
  19. }
  20. err := ModelJwt.JsonInBlacklist()
  21. if err != nil {
  22. response.Result(response.ERROR, gin.H{}, fmt.Sprintf("jwt作废失败,%v", err), c)
  23. } else {
  24. response.Result(response.SUCCESS, gin.H{}, "jwt作废成功", c)
  25. }
  26. }