diff --git a/internal/controller/user_controller.go b/internal/controller/user_controller.go index 028f9302..3d4d2d3a 100644 --- a/internal/controller/user_controller.go +++ b/internal/controller/user_controller.go @@ -89,22 +89,6 @@ func (uc *UserController) GetOtherUserInfoByUsername(ctx *gin.Context) { handler.HandleResponse(ctx, err, resp) } -// GetUserStatus get user status info -// @Summary get user status info -// @Description get user status info -// @Tags User -// @Accept json -// @Produce json -// @Security ApiKeyAuth -// @Success 200 {object} handler.RespBody{data=schema.GetUserResp} -// @Router /answer/api/v1/user/status [get] -func (uc *UserController) GetUserStatus(ctx *gin.Context) { - userID := middleware.GetLoginUserIDFromContext(ctx) - token := middleware.ExtractToken(ctx) - resp, err := uc.userService.GetUserStatus(ctx, userID, token) - handler.HandleResponse(ctx, err, resp) -} - // UserEmailLogin godoc // @Summary UserEmailLogin // @Description UserEmailLogin diff --git a/internal/router/answer_api_router.go b/internal/router/answer_api_router.go index 522eac09..fc7fab95 100644 --- a/internal/router/answer_api_router.go +++ b/internal/router/answer_api_router.go @@ -91,7 +91,6 @@ func (a *AnswerAPIRouter) RegisterUnAuthAnswerAPIRouter(r *gin.RouterGroup) { // user r.GET("/user/info", a.userController.GetUserInfoByUserID) - r.GET("/user/status", a.userController.GetUserStatus) r.GET("/user/action/record", a.userController.ActionRecord) r.POST("/user/login/email", a.userController.UserEmailLogin) r.POST("/user/register/email", a.userController.UserRegisterByEmail) diff --git a/internal/service/user_service.go b/internal/service/user_service.go index 76ce0d8a..07594c90 100644 --- a/internal/service/user_service.go +++ b/internal/service/user_service.go @@ -71,35 +71,6 @@ func (us *UserService) GetUserInfoByUserID(ctx context.Context, token, userID st return resp, nil } -// GetUserStatus get user info by user id -func (us *UserService) GetUserStatus(ctx context.Context, userID, token string) (resp *schema.GetUserStatusResp, err error) { - resp = &schema.GetUserStatusResp{} - if len(userID) == 0 { - return resp, nil - } - userInfo, exist, err := us.userRepo.GetByUserID(ctx, userID) - if err != nil { - return nil, err - } - if !exist { - return nil, errors.BadRequest(reason.UserNotFound) - } - - userCacheInfo := &entity.UserCacheInfo{ - UserID: userID, - UserStatus: userInfo.Status, - EmailStatus: userInfo.MailStatus, - } - err = us.authService.UpdateUserCacheInfo(ctx, token, userCacheInfo) - if err != nil { - return nil, err - } - resp = &schema.GetUserStatusResp{ - Status: schema.UserStatusShow[userInfo.Status], - } - return resp, nil -} - func (us *UserService) GetOtherUserInfoByUsername(ctx context.Context, username string) ( resp *schema.GetOtherUserInfoResp, err error, ) {