2026-06-15 09:20:56 +08:00
|
|
|
package order
|
|
|
|
|
|
|
|
|
|
import (
|
2026-06-18 18:24:35 +09:00
|
|
|
"context"
|
2026-06-15 09:20:56 +08:00
|
|
|
"net/http"
|
|
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/rest/httpx"
|
2026-06-18 18:24:35 +09:00
|
|
|
"github.com/zeromicro/go-zero/rest/pathvar"
|
2026-06-15 09:20:56 +08:00
|
|
|
"muyu-apiserver/gateway/internal/logic/purchase/order"
|
|
|
|
|
"muyu-apiserver/gateway/internal/svc"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func GetPurchaseOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
2026-06-18 18:24:35 +09:00
|
|
|
ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"])
|
|
|
|
|
l := order.NewGetPurchaseOrderLogic(ctx, svcCtx)
|
2026-06-15 09:20:56 +08:00
|
|
|
resp, err := l.GetPurchaseOrder()
|
|
|
|
|
if err != nil {
|
|
|
|
|
httpx.ErrorCtx(r.Context(), w, err)
|
|
|
|
|
} else {
|
|
|
|
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|