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

  1. package api
  2. import (
  3. "fmt"
  4. "gin-vue-admin/controller/servers"
  5. "gin-vue-admin/model/sysModel"
  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 := sysModel.JwtBlacklist{
  18. Jwt:token,
  19. }
  20. err := ModelJwt.JsonInBlacklist()
  21. if err != nil {
  22. servers.ReportFormat(c, false, fmt.Sprintf("jwt作废失败,%v", err), gin.H{})
  23. } else {
  24. servers.ReportFormat(c, true, "jwt作废成功", gin.H{})
  25. }
  26. }