// 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" ) func ProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.ProductListReq if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, response.ErrBadRequest(err.Error())) return } l := product.NewProductListLogic(r.Context(), svcCtx) resp, err := l.ProductList(&req) if err != nil { httpx.ErrorCtx(r.Context(), w, err) } else { httpx.OkJsonCtx(r.Context(), w, resp) } } }