zhangqian
2023-08-29 cd6940f07750c1e2cd3a5c0eeafa6cc0309ef2f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package system
 
import (
    "github.com/gin-gonic/gin"
    "go.uber.org/zap"
    "srm/global"
    "srm/model/common/response"
    "srm/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 {
        global.GVA_LOG.Error("jwt作废失败!", zap.Error(err))
        response.FailWithMessage("jwt作废失败", c)
        return
    }
    response.OkWithMessage("jwt作废成功", c)
}