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

Method DetailPub

internal/api/post.go:218–234  ·  view source on GitHub ↗

DetailPub 获取公开帖子详情

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

216
217// DetailPub 获取公开帖子详情
218func (ph *PostHandler) DetailPub(ctx *gin.Context) {
219 var req req.DetailReq
220 if err := ctx.ShouldBindUri(&req); err != nil {
221 apiresponse.ErrorWithMessage(ctx, "无效的请求参数")
222 return
223 }
224
225 uid := currentUserID(ctx)
226
227 post, err := ph.svc.GetPublishPostById(ctx, req.PostId, uid)
228 if err != nil {
229 apiresponse.ErrorWithMessage(ctx, err.Error())
230 return
231 }
232
233 apiresponse.SuccessWithData(ctx, post)
234}
235
236// DeletePost 删除帖子
237func (ph *PostHandler) DeletePost(ctx *gin.Context) {

Callers

nothing calls this directly

Calls 4

ErrorWithMessageFunction · 0.92
SuccessWithDataFunction · 0.92
currentUserIDFunction · 0.85
GetPublishPostByIdMethod · 0.65

Tested by

no test coverage detected