GetPost 获取帖子详情
(ctx *gin.Context)
| 334 | |
| 335 | // GetPost 获取帖子详情 |
| 336 | func (ph *PostHandler) GetPost(ctx *gin.Context) { |
| 337 | var req req.DetailPostReq |
| 338 | if err := ctx.ShouldBindUri(&req); err != nil { |
| 339 | apiresponse.ErrorWithMessage(ctx, "无效的请求参数") |
| 340 | return |
| 341 | } |
| 342 | |
| 343 | post, err := ph.svc.GetPost(ctx, req.PostId) |
| 344 | if err != nil { |
| 345 | apiresponse.ErrorWithMessage(ctx, err.Error()) |
| 346 | return |
| 347 | } |
| 348 | |
| 349 | apiresponse.SuccessWithData(ctx, post) |
| 350 | } |
| 351 | |
| 352 | // GetPostsCount 获取帖子总数 |
| 353 | func (ph *PostHandler) GetPostsCount(ctx *gin.Context) { |
nothing calls this directly
no test coverage detected