// Code scaffolded by goctl. Safe to edit. // goctl 1.10.0 package product import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" "perms-system-server/internal/logic/product" "perms-system-server/internal/response" "perms-system-server/internal/svc" "perms-system-server/internal/types" ) // UpdateProductHandler 更新产品信息接口。可修改名称、备注和启用/禁用状态。 func UpdateProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.UpdateProductReq if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, response.ErrBadRequest(err.Error())) return } l := product.NewUpdateProductLogic(r.Context(), svcCtx) err := l.UpdateProduct(&req) if err != nil { httpx.ErrorCtx(r.Context(), w, err) } else { httpx.OkJsonCtx(r.Context(), w, nil) } } }