fusenapi/server/product/internal/handler/getsizebyproducthandler.go

27 lines
647 B
Go
Raw Normal View History

2023-06-07 09:27:17 +00:00
package handler
import (
"errors"
"net/http"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
2023-06-08 03:03:20 +00:00
"fusenapi/server/product/internal/logic"
"fusenapi/server/product/internal/svc"
2023-06-07 09:27:17 +00:00
)
func GetSizeByProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := logic.NewGetSizeByProductLogic(r.Context(), svcCtx)
resp := l.GetSizeByProduct()
if resp != nil {
httpx.OkJsonCtx(r.Context(), w, resp)
} else {
err := errors.New("server logic is error, resp must not be nil")
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
}
}
}