| 123456789101112131415161718192021222324252627 |
- 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"
- "slow_wild_api/apps/internal/utils"
- "github.com/zeromicro/go-zero/rest/httpx"
- )
- // 发布评论
- func postCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req types.PostCommentReq
- if err := httpx.Parse(r, &req); err != nil {
- httpx.ErrorCtx(r.Context(), w, err)
- return
- }
- ip := utils.GetRealIP(r)
- l := logic.NewPostCommentLogic(r.Context(), svcCtx)
- resp, err := l.PostComment(&req, ip, "")
- response.Response(w, resp, err)
- }
- }
|