load_chart_data_handler.go 835 字节
package chart

import (
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/pkg/result"
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/logic/chart"
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/svc"
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc-bchart/cmd/chart-server/api/internal/types"
)

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

		l := chart.NewLoadChartDataLogic(r.Context(), svcCtx)
		resp, err := l.LoadChartData(&req)
		result.HttpResult(r, w, resp, err)
	}
}