// Code scaffolded by goctl. Safe to edit. package yarn import ( "context" "net/http" "github.com/zeromicro/go-zero/rest/httpx" "github.com/zeromicro/go-zero/rest/pathvar" "muyu-apiserver/gateway/internal/logic/inventory/yarn" "muyu-apiserver/gateway/internal/svc" "muyu-apiserver/gateway/internal/types" ) func UpdateYarnHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UpdateYarnReq if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return } ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"]) l := yarn.NewUpdateYarnLogic(ctx, svcCtx) resp, err := l.UpdateYarn(&req) if err != nil { httpx.ErrorCtx(r.Context(), w, err) } else { httpx.OkJsonCtx(r.Context(), w, resp) } } }