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.

29 lines
710 B

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