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

Method Publish

internal/api/post.go:100–118  ·  view source on GitHub ↗

Publish 发布帖子

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

98
99// Publish 发布帖子
100func (ph *PostHandler) Publish(ctx *gin.Context) {
101 var req req.PublishReq
102 if err := ctx.ShouldBindJSON(&req); err != nil {
103 apiresponse.ErrorWithMessage(ctx, "无效的请求参数")
104 return
105 }
106
107 uc, ok := requireUser(ctx)
108 if !ok {
109 return
110 }
111
112 if err := ph.svc.Publish(ctx, req.PostId, uc.Uid); err != nil {
113 apiresponse.ErrorWithMessage(ctx, err.Error())
114 return
115 }
116
117 apiresponse.SuccessWithData(ctx, req.PostId)
118}
119
120// Withdraw 撤回帖子
121func (ph *PostHandler) Withdraw(ctx *gin.Context) {

Callers

nothing calls this directly

Calls 4

ErrorWithMessageFunction · 0.92
SuccessWithDataFunction · 0.92
requireUserFunction · 0.85
PublishMethod · 0.65

Tested by

no test coverage detected