package admin_agent

import (
	"net/http"

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

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