logout.go 921 B

12345678910111213141516171819202122232425262728
  1. package admin_common
  2. import (
  3. "fmt"
  4. "github.com/gin-gonic/gin"
  5. "net/http"
  6. "sghgogs.com/sghblog/authorization-client/response"
  7. "sghgogs.com/sghblog/authorization-client/utils"
  8. pb "sghgogs.com/sghblog/authorization-service/proto"
  9. )
  10. // Logout
  11. // @summary 退出登录
  12. // @Description
  13. // @Tags Common
  14. // @Accept json
  15. // @Produce json
  16. // @Param Authorization header string true "Bearer 用户令牌"
  17. // @Success 200 {object} response.ApiResponse "成功"
  18. // @Failure 400 {object} response.ApiResponse "请求错误"
  19. // @Failure 500 {object} response.ApiResponse "内部错误"
  20. // @Router /v1/api/admin/profile [post]
  21. func (svc *ApiAdminCommon) Logout(c *gin.Context) {
  22. ctx, _ := utils.CreateContextWithToken(c, "authorizationservice", "CommonService.AdminLogout")
  23. logout, err := svc.Service.AdminLogout(ctx, &pb.AdminLogoutRequest{})
  24. fmt.Println(logout, err)
  25. c.JSON(http.StatusOK, response.SuccessResponse(nil))
  26. }