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
770 B

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