Withdraw 撤回帖子
(ctx *gin.Context)
| 119 | |
| 120 | // Withdraw 撤回帖子 |
| 121 | func (ph *PostHandler) Withdraw(ctx *gin.Context) { |
| 122 | var req req.WithDrawReq |
| 123 | if err := ctx.ShouldBindJSON(&req); err != nil { |
| 124 | apiresponse.ErrorWithMessage(ctx, "无效的请求参数") |
| 125 | return |
| 126 | } |
| 127 | |
| 128 | uc, ok := requireUser(ctx) |
| 129 | if !ok { |
| 130 | return |
| 131 | } |
| 132 | |
| 133 | if err := ph.svc.Withdraw(ctx, req.PostId, uc.Uid); err != nil { |
| 134 | apiresponse.ErrorWithMessage(ctx, err.Error()) |
| 135 | return |
| 136 | } |
| 137 | |
| 138 | apiresponse.SuccessWithData(ctx, req.PostId) |
| 139 | } |
| 140 | |
| 141 | // List 获取个人帖子列表 |
| 142 | func (ph *PostHandler) List(ctx *gin.Context) { |
nothing calls this directly
no test coverage detected