12345678910111213141516171819202122232425262728293031 |
- package system
- import (
- "github.com/gin-gonic/gin"
- "github.com/sirupsen/logrus"
- "go.uber.org/zap"
- "lc-base-frame/model/common/response"
- "lc-base-frame/model/system"
- )
- 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 := c.Request.Header.Get("x-token")
- jwt := system.JwtBlacklist{Jwt: token}
- err := jwtService.JsonInBlacklist(jwt)
- if err != nil {
- logrus.Error("jwt作废失败!", zap.Error(err))
- response.FailWithMessage("jwt作废失败", c)
- return
- }
- response.OkWithMessage("jwt作废成功", c)
- }
|