package handler import ( "net/http" "slow_wild_api/apps/internal/logic" "slow_wild_api/apps/internal/response" "slow_wild_api/apps/internal/svc" "slow_wild_api/apps/internal/types" "github.com/zeromicro/go-zero/rest/httpx" ) // 创建帖子 func createPostHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreatePostReq if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return } l := logic.NewCreatePostLogic(r.Context(), svcCtx) resp, err := l.CreatePost(&req) response.Response(w, resp, err) } }