GetPostsByPlate 根据板块获取帖子
(ctx *gin.Context)
| 361 | |
| 362 | // GetPostsByPlate 根据板块获取帖子 |
| 363 | func (ph *PostHandler) GetPostsByPlate(ctx *gin.Context) { |
| 364 | var req req.SearchByPlateReq |
| 365 | if err := ctx.ShouldBindJSON(&req); err != nil { |
| 366 | apiresponse.ErrorWithMessage(ctx, "无效的请求参数") |
| 367 | return |
| 368 | } |
| 369 | |
| 370 | posts, err := ph.svc.GetPostsByPlate(ctx, req.PlateId, domain.Pagination{ |
| 371 | Page: req.Page, |
| 372 | Size: req.Size, |
| 373 | }) |
| 374 | if err != nil { |
| 375 | apiresponse.ErrorWithMessage(ctx, err.Error()) |
| 376 | return |
| 377 | } |
| 378 | |
| 379 | apiresponse.SuccessWithData(ctx, posts) |
| 380 | } |
nothing calls this directly
no test coverage detected