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

Method ListPub

internal/api/post.go:168–188  ·  view source on GitHub ↗

ListPub 获取公开帖子列表

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

166
167// ListPub 获取公开帖子列表
168func (ph *PostHandler) ListPub(ctx *gin.Context) {
169 var req req.ListReq
170 if err := ctx.ShouldBindJSON(&req); err != nil {
171 apiresponse.ErrorWithMessage(ctx, "无效的请求参数")
172 return
173 }
174
175 uid := currentUserID(ctx)
176
177 du, err := ph.svc.ListPublishPosts(ctx, domain.Pagination{
178 Page: req.Page,
179 Size: req.Size,
180 Uid: uid,
181 })
182 if err != nil {
183 apiresponse.ErrorWithMessage(ctx, err.Error())
184 return
185 }
186
187 apiresponse.SuccessWithData(ctx, du)
188}
189
190// Detail 获取帖子详情
191func (ph *PostHandler) Detail(ctx *gin.Context) {

Callers

nothing calls this directly

Calls 4

ErrorWithMessageFunction · 0.92
SuccessWithDataFunction · 0.92
currentUserIDFunction · 0.85
ListPublishPostsMethod · 0.65

Tested by

no test coverage detected