package system import ( "kra/pkg/response" "kra/pkg/utils" "github.com/gin-gonic/gin" ) type JwtApi struct{} // JsonInBlacklist // @Tags Jwt // @Summary jwt加入黑名单 // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Success 200 {object} response.Response{msg=string} "jwt加入黑名单" // @Router /jwt/jsonInBlacklist [post] func (j *JwtApi) JsonInBlacklist(c *gin.Context) { token := utils.GetToken(c) if token == "" { response.FailWithMessage("token不存在", c) return } if err := jwtBlacklistUsecase.JsonInBlacklist(c, token); err != nil { response.FailWithMessage("jwt作废失败: "+err.Error(), c) return } utils.ClearToken(c) response.OkWithMessage("jwt作废成功", c) }