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.
30 lines
803 B
30 lines
803 B
package system
|
|
|
|
import (
|
|
"gin-vue-admin/global"
|
|
"gin-vue-admin/model/common/response"
|
|
"gin-vue-admin/model/system"
|
|
"github.com/gin-gonic/gin"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
type JwtApi struct {
|
|
}
|
|
|
|
// @Tags Jwt
|
|
// @Summary jwt加入黑名单
|
|
// @Security ApiKeyAuth
|
|
// @accept application/json
|
|
// @Produce application/json
|
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"拉黑成功"}"
|
|
// @Router /jwt/jsonInBlacklist [post]
|
|
func (j *JwtApi) JsonInBlacklist(c *gin.Context) {
|
|
token := c.Request.Header.Get("x-token")
|
|
jwt := system.JwtBlacklist{Jwt: token}
|
|
if err := jwtService.JsonInBlacklist(jwt); err != nil {
|
|
global.GVA_LOG.Error("jwt作废失败!", zap.Any("err", err))
|
|
response.FailWithMessage("jwt作废失败", c)
|
|
} else {
|
|
response.OkWithMessage("jwt作废成功", c)
|
|
}
|
|
}
|