2022-09-17 18:10:06 +08:00
|
|
|
package user
|
|
|
|
|
|
|
|
import (
|
2023-07-14 21:47:11 +08:00
|
|
|
"git.0x7f.app/WOJ/woj-server/internal/e"
|
2023-07-15 16:19:49 +08:00
|
|
|
"git.0x7f.app/WOJ/woj-server/internal/model"
|
2022-09-17 18:10:06 +08:00
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Logout
|
|
|
|
// @Summary logout
|
|
|
|
// @Description logout
|
2023-12-18 21:21:15 +08:00
|
|
|
// @Tags user
|
2022-09-17 18:10:06 +08:00
|
|
|
// @Accept application/x-www-form-urlencoded
|
|
|
|
// @Produce json
|
|
|
|
// @Response 200 {object} e.Response "nil"
|
|
|
|
// @Security Authentication
|
|
|
|
// @Router /v1/user/logout [post]
|
|
|
|
func (h *handler) Logout(c *gin.Context) {
|
|
|
|
claim, exist := c.Get("claim")
|
|
|
|
if !exist {
|
|
|
|
e.Pong(c, e.UserUnauthenticated, nil)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-07-15 16:19:49 +08:00
|
|
|
_, status := h.userService.IncrVersion(claim.(*model.Claim).UID)
|
2022-09-20 14:15:21 +08:00
|
|
|
e.Pong(c, status, nil)
|
2022-09-17 18:10:06 +08:00
|
|
|
}
|