MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / GetPost

Method GetPost

internal/api/post.go:336–350  ·  view source on GitHub ↗

GetPost 获取帖子详情

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

334
335// GetPost 获取帖子详情
336func (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 获取帖子总数
353func (ph *PostHandler) GetPostsCount(ctx *gin.Context) {

Callers

nothing calls this directly

Calls 3

ErrorWithMessageFunction · 0.92
SuccessWithDataFunction · 0.92
GetPostMethod · 0.65

Tested by

no test coverage detected