muyu-apiserver/gateway/internal/handler/purchase/stats/getpurchasestatsbyproducthandler.go
Chever John a25acdc5e4 chore: sync codebase with upstream
Pull latest changes from upstream/main (GitHub) including:
- Purchase RPC service (proto, server, logic, models)
- Gateway route updates for purchase endpoints
- SQL migration and config updates

Excludes deploy/bin/ pre-compiled arm64 binaries (builds use
multi-stage Dockerfiles targeting amd64).
2026-06-15 09:20:56 +08:00

29 lines
735 B
Go

package stats
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"muyu-apiserver/gateway/internal/logic/purchase/stats"
"muyu-apiserver/gateway/internal/svc"
"muyu-apiserver/gateway/internal/types"
)
func GetPurchaseStatsByProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.PurchaseStatsSummaryReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := stats.NewGetPurchaseStatsByProductLogic(r.Context(), svcCtx)
resp, err := l.GetPurchaseStatsByProduct(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}