package handler

import (
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"
	"jyBXCore/api/internal/logic"
	"jyBXCore/api/internal/svc"
	"jyBXCore/api/internal/types"
)

func ParticipateContentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.ParticipateContentReq
		if err := httpx.Parse(r, &req); err != nil {
			httpx.Error(w, err)
			return
		}

		l := logic.NewParticipateContentLogic(r.Context(), svcCtx, r)
		resp, err := l.ParticipateContent(&req)
		if err != nil {
			httpx.Error(w, err)
		} else {
			httpx.OkJson(w, resp)
		}
	}
}
