package admin_agent

import (
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"
	"sim-server/app/main/api/internal/logic/admin_agent"
	"sim-server/app/main/api/internal/svc"
)

func AdminGetProductDistributionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := admin_agent.NewAdminGetProductDistributionLogic(r.Context(), svcCtx)
		resp, err := l.AdminGetProductDistribution()
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
		} else {
			httpx.OkJsonCtx(r.Context(), w, resp)
		}
	}
}
