muyu-apiserver/gateway/internal/handler/production/plan/getproductionplanhandler.go

25 lines
649 B
Go

package plan
import (
"context"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"github.com/zeromicro/go-zero/rest/pathvar"
"muyu-apiserver/gateway/internal/logic/production/plan"
"muyu-apiserver/gateway/internal/svc"
)
func GetProductionPlanHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["planId"])
l := plan.NewGetProductionPlanLogic(ctx, svcCtx)
resp, err := l.GetProductionPlan()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}