fusenapi/product/internal/handler/getproductlisthandler.go

29 lines
665 B
Go
Raw Normal View History

2023-06-01 07:32:28 +00:00
package handler
import (
"net/http"
"fusenapi/product/internal/logic"
"fusenapi/product/internal/svc"
"fusenapi/product/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func GetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetProductListReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewGetProductListLogic(r.Context(), svcCtx)
resp, err := l.GetProductList(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}