FollowUser 处理关注用户的请求
(ctx *gin.Context, req req.FollowUserReq)
| 69 | |
| 70 | // FollowUser 处理关注用户的请求 |
| 71 | func (r *RelationHandler) FollowUser(ctx *gin.Context, req req.FollowUserReq) (Result, error) { |
| 72 | uc, ok := requireUser(ctx) |
| 73 | if !ok { |
| 74 | return Result{ |
| 75 | Code: FollowUserERRORCode, |
| 76 | Msg: "未登录或登录已过期", |
| 77 | }, nil |
| 78 | } |
| 79 | |
| 80 | if err := r.svc.FollowUser(ctx, uc.Uid, req.FolloweeID); err != nil { |
| 81 | return Result{ |
| 82 | Code: FollowUserERRORCode, |
| 83 | Msg: FollowUserERRORMsg, |
| 84 | }, err |
| 85 | } |
| 86 | return Result{ |
| 87 | Code: RequestsOK, |
| 88 | Msg: FollowUserSuccessMsg, |
| 89 | }, nil |
| 90 | } |
| 91 | |
| 92 | func (r *RelationHandler) CancelFollowUser(ctx *gin.Context, req req.CancelFollowUserReq) (Result, error) { |
| 93 | uc, ok := requireUser(ctx) |
nothing calls this directly
no test coverage detected