From 43d876ff046cecc79ed2ad1802176fee679bf520 Mon Sep 17 00:00:00 2001 From: Matrix-X Date: Tue, 10 Oct 2023 00:34:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BA=A7=E5=93=81=E7=BB=9F=E8=AE=A1=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../crm/customer/auth/authbyphonehandler.go | 28 +++++++++++++++++++ .../crm/customer/auth/authbyprofilehandler.go | 21 ++++++++++++++ .../mp/crm/customer/auth/loginhandler.go | 28 +++++++++++++++++++ .../crm/market/media/listmediaspagehandler.go | 28 +++++++++++++++++++ .../crm/market/store/liststorespagehandler.go | 28 +++++++++++++++++++ .../crm/product/artisan/getartisanhandler.go | 28 +++++++++++++++++++ .../artisan/listartisanspagehandler.go | 28 +++++++++++++++++++ .../mp/crm/product/getproducthandler.go | 28 +++++++++++++++++++ .../product/listproductcategorieshandler.go | 28 +++++++++++++++++++ .../product/listproductcategorytreehandler.go | 28 +++++++++++++++++++ .../mp/crm/product/listproductspagehandler.go | 28 +++++++++++++++++++ .../billing/createbillingaddresshandler.go | 28 +++++++++++++++++++ .../billing/deletebillingaddresshandler.go | 28 +++++++++++++++++++ .../billing/getbillingaddresshandler.go | 28 +++++++++++++++++++ .../listbillingaddressespagehandler.go | 28 +++++++++++++++++++ .../billing/patchbillingaddresshandler.go | 28 +++++++++++++++++++ .../billing/putbillingaddresshandler.go | 28 +++++++++++++++++++ .../delivery/createdeliveryaddresshandler.go | 28 +++++++++++++++++++ .../delivery/deletedeliveryaddresshandler.go | 28 +++++++++++++++++++ .../delivery/getdeliveryaddresshandler.go | 28 +++++++++++++++++++ .../listdeliveryaddressespagehandler.go | 28 +++++++++++++++++++ .../delivery/patchdeliveryaddresshandler.go | 28 +++++++++++++++++++ .../delivery/putdeliveryaddresshandler.go | 28 +++++++++++++++++++ .../shipping/createshippingaddresshandler.go | 28 +++++++++++++++++++ .../shipping/deleteshippingaddresshandler.go | 28 +++++++++++++++++++ .../shipping/getshippingaddresshandler.go | 28 +++++++++++++++++++ .../listshippingaddressespagehandler.go | 28 +++++++++++++++++++ .../shipping/patchshippingaddresshandler.go | 28 +++++++++++++++++++ .../shipping/putshippingaddresshandler.go | 28 +++++++++++++++++++ .../mp/crm/trade/cart/addtocarthandler.go | 28 +++++++++++++++++++ .../crm/trade/cart/clearcartitemshandler.go | 28 +++++++++++++++++++ .../mp/crm/trade/cart/getcarthandler.go | 28 +++++++++++++++++++ .../trade/cart/listcartitemspagehandler.go | 28 +++++++++++++++++++ .../crm/trade/cart/removecartitemhandler.go | 28 +++++++++++++++++++ .../cart/updatecartitemquantityhandler.go | 28 +++++++++++++++++++ .../mp/crm/trade/order/cancelorderhandler.go | 28 +++++++++++++++++++ .../order/createorderbycartitemshandler.go | 28 +++++++++++++++++++ .../order/createorderbyproductshandler.go | 28 +++++++++++++++++++ .../mp/crm/trade/order/getorderhandler.go | 28 +++++++++++++++++++ .../crm/trade/order/listorderspagehandler.go | 28 +++++++++++++++++++ .../payment/createpaymentfromorderhandler.go | 28 +++++++++++++++++++ .../mp/crm/trade/payment/getpaymenthandler.go | 28 +++++++++++++++++++ .../trade/payment/listpaymentspagehandler.go | 28 +++++++++++++++++++ .../crm/trade/payment/updatepaymenthandler.go | 28 +++++++++++++++++++ 44 files changed, 1225 insertions(+) create mode 100644 internal/handler/mp/crm/customer/auth/authbyphonehandler.go create mode 100644 internal/handler/mp/crm/customer/auth/authbyprofilehandler.go create mode 100644 internal/handler/mp/crm/customer/auth/loginhandler.go create mode 100644 internal/handler/mp/crm/market/media/listmediaspagehandler.go create mode 100644 internal/handler/mp/crm/market/store/liststorespagehandler.go create mode 100644 internal/handler/mp/crm/product/artisan/getartisanhandler.go create mode 100644 internal/handler/mp/crm/product/artisan/listartisanspagehandler.go create mode 100644 internal/handler/mp/crm/product/getproducthandler.go create mode 100644 internal/handler/mp/crm/product/listproductcategorieshandler.go create mode 100644 internal/handler/mp/crm/product/listproductcategorytreehandler.go create mode 100644 internal/handler/mp/crm/product/listproductspagehandler.go create mode 100644 internal/handler/mp/crm/trade/address/billing/createbillingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/billing/deletebillingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/billing/getbillingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/billing/listbillingaddressespagehandler.go create mode 100644 internal/handler/mp/crm/trade/address/billing/patchbillingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/billing/putbillingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/delivery/createdeliveryaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/delivery/deletedeliveryaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/delivery/getdeliveryaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/delivery/listdeliveryaddressespagehandler.go create mode 100644 internal/handler/mp/crm/trade/address/delivery/patchdeliveryaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/delivery/putdeliveryaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/shipping/createshippingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/shipping/deleteshippingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/shipping/getshippingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/shipping/listshippingaddressespagehandler.go create mode 100644 internal/handler/mp/crm/trade/address/shipping/patchshippingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/address/shipping/putshippingaddresshandler.go create mode 100644 internal/handler/mp/crm/trade/cart/addtocarthandler.go create mode 100644 internal/handler/mp/crm/trade/cart/clearcartitemshandler.go create mode 100644 internal/handler/mp/crm/trade/cart/getcarthandler.go create mode 100644 internal/handler/mp/crm/trade/cart/listcartitemspagehandler.go create mode 100644 internal/handler/mp/crm/trade/cart/removecartitemhandler.go create mode 100644 internal/handler/mp/crm/trade/cart/updatecartitemquantityhandler.go create mode 100644 internal/handler/mp/crm/trade/order/cancelorderhandler.go create mode 100644 internal/handler/mp/crm/trade/order/createorderbycartitemshandler.go create mode 100644 internal/handler/mp/crm/trade/order/createorderbyproductshandler.go create mode 100644 internal/handler/mp/crm/trade/order/getorderhandler.go create mode 100644 internal/handler/mp/crm/trade/order/listorderspagehandler.go create mode 100644 internal/handler/mp/crm/trade/payment/createpaymentfromorderhandler.go create mode 100644 internal/handler/mp/crm/trade/payment/getpaymenthandler.go create mode 100644 internal/handler/mp/crm/trade/payment/listpaymentspagehandler.go create mode 100644 internal/handler/mp/crm/trade/payment/updatepaymenthandler.go diff --git a/internal/handler/mp/crm/customer/auth/authbyphonehandler.go b/internal/handler/mp/crm/customer/auth/authbyphonehandler.go new file mode 100644 index 00000000..6c7f8418 --- /dev/null +++ b/internal/handler/mp/crm/customer/auth/authbyphonehandler.go @@ -0,0 +1,28 @@ +package auth + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/customer/auth" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func AuthByPhoneHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.MPCustomerAuthRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := auth.NewAuthByPhoneLogic(r.Context(), svcCtx) + resp, err := l.AuthByPhone(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/customer/auth/authbyprofilehandler.go b/internal/handler/mp/crm/customer/auth/authbyprofilehandler.go new file mode 100644 index 00000000..64dcebf9 --- /dev/null +++ b/internal/handler/mp/crm/customer/auth/authbyprofilehandler.go @@ -0,0 +1,21 @@ +package auth + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/customer/auth" + "PowerX/internal/svc" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func AuthByProfileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + l := auth.NewAuthByProfileLogic(r.Context(), svcCtx) + resp, err := l.AuthByProfile() + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/customer/auth/loginhandler.go b/internal/handler/mp/crm/customer/auth/loginhandler.go new file mode 100644 index 00000000..3ee225a2 --- /dev/null +++ b/internal/handler/mp/crm/customer/auth/loginhandler.go @@ -0,0 +1,28 @@ +package auth + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/customer/auth" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func LoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.MPCustomerLoginRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := auth.NewLoginLogic(r.Context(), svcCtx) + resp, err := l.Login(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/market/media/listmediaspagehandler.go b/internal/handler/mp/crm/market/media/listmediaspagehandler.go new file mode 100644 index 00000000..ee815d6e --- /dev/null +++ b/internal/handler/mp/crm/market/media/listmediaspagehandler.go @@ -0,0 +1,28 @@ +package media + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/market/media" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListMediasPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListMediasPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := media.NewListMediasPageLogic(r.Context(), svcCtx) + resp, err := l.ListMediasPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/market/store/liststorespagehandler.go b/internal/handler/mp/crm/market/store/liststorespagehandler.go new file mode 100644 index 00000000..45bf5b12 --- /dev/null +++ b/internal/handler/mp/crm/market/store/liststorespagehandler.go @@ -0,0 +1,28 @@ +package store + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/market/store" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListStoresPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListStoresPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := store.NewListStoresPageLogic(r.Context(), svcCtx) + resp, err := l.ListStoresPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/product/artisan/getartisanhandler.go b/internal/handler/mp/crm/product/artisan/getartisanhandler.go new file mode 100644 index 00000000..c46bf473 --- /dev/null +++ b/internal/handler/mp/crm/product/artisan/getartisanhandler.go @@ -0,0 +1,28 @@ +package artisan + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/product/artisan" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetArtisanHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetArtisanRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := artisan.NewGetArtisanLogic(r.Context(), svcCtx) + resp, err := l.GetArtisan(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/product/artisan/listartisanspagehandler.go b/internal/handler/mp/crm/product/artisan/listartisanspagehandler.go new file mode 100644 index 00000000..d068a582 --- /dev/null +++ b/internal/handler/mp/crm/product/artisan/listartisanspagehandler.go @@ -0,0 +1,28 @@ +package artisan + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/product/artisan" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListArtisansPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListArtisansPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := artisan.NewListArtisansPageLogic(r.Context(), svcCtx) + resp, err := l.ListArtisansPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/product/getproducthandler.go b/internal/handler/mp/crm/product/getproducthandler.go new file mode 100644 index 00000000..18117423 --- /dev/null +++ b/internal/handler/mp/crm/product/getproducthandler.go @@ -0,0 +1,28 @@ +package product + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/product" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetProductRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := product.NewGetProductLogic(r.Context(), svcCtx) + resp, err := l.GetProduct(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/product/listproductcategorieshandler.go b/internal/handler/mp/crm/product/listproductcategorieshandler.go new file mode 100644 index 00000000..d0416d5f --- /dev/null +++ b/internal/handler/mp/crm/product/listproductcategorieshandler.go @@ -0,0 +1,28 @@ +package product + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/product" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListProductCategoriesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListProductCategoriesRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := product.NewListProductCategoriesLogic(r.Context(), svcCtx) + resp, err := l.ListProductCategories(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/product/listproductcategorytreehandler.go b/internal/handler/mp/crm/product/listproductcategorytreehandler.go new file mode 100644 index 00000000..4718c67d --- /dev/null +++ b/internal/handler/mp/crm/product/listproductcategorytreehandler.go @@ -0,0 +1,28 @@ +package product + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/product" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListProductCategoryTreeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListProductCategoryTreeRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := product.NewListProductCategoryTreeLogic(r.Context(), svcCtx) + resp, err := l.ListProductCategoryTree(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/product/listproductspagehandler.go b/internal/handler/mp/crm/product/listproductspagehandler.go new file mode 100644 index 00000000..0e4bcd1d --- /dev/null +++ b/internal/handler/mp/crm/product/listproductspagehandler.go @@ -0,0 +1,28 @@ +package product + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/product" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListProductsPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListProductsPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := product.NewListProductsPageLogic(r.Context(), svcCtx) + resp, err := l.ListProductsPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/billing/createbillingaddresshandler.go b/internal/handler/mp/crm/trade/address/billing/createbillingaddresshandler.go new file mode 100644 index 00000000..b372a472 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/billing/createbillingaddresshandler.go @@ -0,0 +1,28 @@ +package billing + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/billing" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func CreateBillingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateBillingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := billing.NewCreateBillingAddressLogic(r.Context(), svcCtx) + resp, err := l.CreateBillingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/billing/deletebillingaddresshandler.go b/internal/handler/mp/crm/trade/address/billing/deletebillingaddresshandler.go new file mode 100644 index 00000000..3c671a0f --- /dev/null +++ b/internal/handler/mp/crm/trade/address/billing/deletebillingaddresshandler.go @@ -0,0 +1,28 @@ +package billing + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/billing" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func DeleteBillingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteBillingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := billing.NewDeleteBillingAddressLogic(r.Context(), svcCtx) + resp, err := l.DeleteBillingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/billing/getbillingaddresshandler.go b/internal/handler/mp/crm/trade/address/billing/getbillingaddresshandler.go new file mode 100644 index 00000000..9bd92f5a --- /dev/null +++ b/internal/handler/mp/crm/trade/address/billing/getbillingaddresshandler.go @@ -0,0 +1,28 @@ +package billing + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/billing" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetBillingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetBillingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := billing.NewGetBillingAddressLogic(r.Context(), svcCtx) + resp, err := l.GetBillingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/billing/listbillingaddressespagehandler.go b/internal/handler/mp/crm/trade/address/billing/listbillingaddressespagehandler.go new file mode 100644 index 00000000..25afd561 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/billing/listbillingaddressespagehandler.go @@ -0,0 +1,28 @@ +package billing + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/billing" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListBillingAddressesPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListBillingAddressesPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := billing.NewListBillingAddressesPageLogic(r.Context(), svcCtx) + resp, err := l.ListBillingAddressesPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/billing/patchbillingaddresshandler.go b/internal/handler/mp/crm/trade/address/billing/patchbillingaddresshandler.go new file mode 100644 index 00000000..4eadf690 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/billing/patchbillingaddresshandler.go @@ -0,0 +1,28 @@ +package billing + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/billing" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func PatchBillingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PatchBillingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := billing.NewPatchBillingAddressLogic(r.Context(), svcCtx) + resp, err := l.PatchBillingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/billing/putbillingaddresshandler.go b/internal/handler/mp/crm/trade/address/billing/putbillingaddresshandler.go new file mode 100644 index 00000000..2cc2e19a --- /dev/null +++ b/internal/handler/mp/crm/trade/address/billing/putbillingaddresshandler.go @@ -0,0 +1,28 @@ +package billing + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/billing" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func PutBillingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PutBillingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := billing.NewPutBillingAddressLogic(r.Context(), svcCtx) + resp, err := l.PutBillingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/delivery/createdeliveryaddresshandler.go b/internal/handler/mp/crm/trade/address/delivery/createdeliveryaddresshandler.go new file mode 100644 index 00000000..2a67a513 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/delivery/createdeliveryaddresshandler.go @@ -0,0 +1,28 @@ +package delivery + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/delivery" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func CreateDeliveryAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateDeliveryAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := delivery.NewCreateDeliveryAddressLogic(r.Context(), svcCtx) + resp, err := l.CreateDeliveryAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/delivery/deletedeliveryaddresshandler.go b/internal/handler/mp/crm/trade/address/delivery/deletedeliveryaddresshandler.go new file mode 100644 index 00000000..a20428f6 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/delivery/deletedeliveryaddresshandler.go @@ -0,0 +1,28 @@ +package delivery + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/delivery" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func DeleteDeliveryAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteDeliveryAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := delivery.NewDeleteDeliveryAddressLogic(r.Context(), svcCtx) + resp, err := l.DeleteDeliveryAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/delivery/getdeliveryaddresshandler.go b/internal/handler/mp/crm/trade/address/delivery/getdeliveryaddresshandler.go new file mode 100644 index 00000000..c0a6a790 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/delivery/getdeliveryaddresshandler.go @@ -0,0 +1,28 @@ +package delivery + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/delivery" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetDeliveryAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetDeliveryAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := delivery.NewGetDeliveryAddressLogic(r.Context(), svcCtx) + resp, err := l.GetDeliveryAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/delivery/listdeliveryaddressespagehandler.go b/internal/handler/mp/crm/trade/address/delivery/listdeliveryaddressespagehandler.go new file mode 100644 index 00000000..71d92667 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/delivery/listdeliveryaddressespagehandler.go @@ -0,0 +1,28 @@ +package delivery + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/delivery" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListDeliveryAddressesPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListDeliveryAddressesPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := delivery.NewListDeliveryAddressesPageLogic(r.Context(), svcCtx) + resp, err := l.ListDeliveryAddressesPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/delivery/patchdeliveryaddresshandler.go b/internal/handler/mp/crm/trade/address/delivery/patchdeliveryaddresshandler.go new file mode 100644 index 00000000..43ddab2a --- /dev/null +++ b/internal/handler/mp/crm/trade/address/delivery/patchdeliveryaddresshandler.go @@ -0,0 +1,28 @@ +package delivery + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/delivery" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func PatchDeliveryAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PatchDeliveryAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := delivery.NewPatchDeliveryAddressLogic(r.Context(), svcCtx) + resp, err := l.PatchDeliveryAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/delivery/putdeliveryaddresshandler.go b/internal/handler/mp/crm/trade/address/delivery/putdeliveryaddresshandler.go new file mode 100644 index 00000000..d08c11c2 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/delivery/putdeliveryaddresshandler.go @@ -0,0 +1,28 @@ +package delivery + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/delivery" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func PutDeliveryAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PutDeliveryAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := delivery.NewPutDeliveryAddressLogic(r.Context(), svcCtx) + resp, err := l.PutDeliveryAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/shipping/createshippingaddresshandler.go b/internal/handler/mp/crm/trade/address/shipping/createshippingaddresshandler.go new file mode 100644 index 00000000..9c85b988 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/shipping/createshippingaddresshandler.go @@ -0,0 +1,28 @@ +package shipping + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/shipping" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func CreateShippingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateShippingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := shipping.NewCreateShippingAddressLogic(r.Context(), svcCtx) + resp, err := l.CreateShippingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/shipping/deleteshippingaddresshandler.go b/internal/handler/mp/crm/trade/address/shipping/deleteshippingaddresshandler.go new file mode 100644 index 00000000..52146457 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/shipping/deleteshippingaddresshandler.go @@ -0,0 +1,28 @@ +package shipping + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/shipping" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func DeleteShippingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.DeleteShippingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := shipping.NewDeleteShippingAddressLogic(r.Context(), svcCtx) + resp, err := l.DeleteShippingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/shipping/getshippingaddresshandler.go b/internal/handler/mp/crm/trade/address/shipping/getshippingaddresshandler.go new file mode 100644 index 00000000..c2432475 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/shipping/getshippingaddresshandler.go @@ -0,0 +1,28 @@ +package shipping + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/shipping" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetShippingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetShippingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := shipping.NewGetShippingAddressLogic(r.Context(), svcCtx) + resp, err := l.GetShippingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/shipping/listshippingaddressespagehandler.go b/internal/handler/mp/crm/trade/address/shipping/listshippingaddressespagehandler.go new file mode 100644 index 00000000..6b115857 --- /dev/null +++ b/internal/handler/mp/crm/trade/address/shipping/listshippingaddressespagehandler.go @@ -0,0 +1,28 @@ +package shipping + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/shipping" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListShippingAddressesPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListShippingAddressesPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := shipping.NewListShippingAddressesPageLogic(r.Context(), svcCtx) + resp, err := l.ListShippingAddressesPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/shipping/patchshippingaddresshandler.go b/internal/handler/mp/crm/trade/address/shipping/patchshippingaddresshandler.go new file mode 100644 index 00000000..e5a84f1e --- /dev/null +++ b/internal/handler/mp/crm/trade/address/shipping/patchshippingaddresshandler.go @@ -0,0 +1,28 @@ +package shipping + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/shipping" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func PatchShippingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PatchShippingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := shipping.NewPatchShippingAddressLogic(r.Context(), svcCtx) + resp, err := l.PatchShippingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/address/shipping/putshippingaddresshandler.go b/internal/handler/mp/crm/trade/address/shipping/putshippingaddresshandler.go new file mode 100644 index 00000000..f8722ffe --- /dev/null +++ b/internal/handler/mp/crm/trade/address/shipping/putshippingaddresshandler.go @@ -0,0 +1,28 @@ +package shipping + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/address/shipping" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func PutShippingAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.PutShippingAddressRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := shipping.NewPutShippingAddressLogic(r.Context(), svcCtx) + resp, err := l.PutShippingAddress(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/cart/addtocarthandler.go b/internal/handler/mp/crm/trade/cart/addtocarthandler.go new file mode 100644 index 00000000..265bd171 --- /dev/null +++ b/internal/handler/mp/crm/trade/cart/addtocarthandler.go @@ -0,0 +1,28 @@ +package cart + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/cart" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func AddToCartHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.AddToCartRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cart.NewAddToCartLogic(r.Context(), svcCtx) + resp, err := l.AddToCart(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/cart/clearcartitemshandler.go b/internal/handler/mp/crm/trade/cart/clearcartitemshandler.go new file mode 100644 index 00000000..263624b1 --- /dev/null +++ b/internal/handler/mp/crm/trade/cart/clearcartitemshandler.go @@ -0,0 +1,28 @@ +package cart + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/cart" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ClearCartItemsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ClearCartItemsRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cart.NewClearCartItemsLogic(r.Context(), svcCtx) + resp, err := l.ClearCartItems(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/cart/getcarthandler.go b/internal/handler/mp/crm/trade/cart/getcarthandler.go new file mode 100644 index 00000000..e7182d2e --- /dev/null +++ b/internal/handler/mp/crm/trade/cart/getcarthandler.go @@ -0,0 +1,28 @@ +package cart + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/cart" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetCartHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetCartRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cart.NewGetCartLogic(r.Context(), svcCtx) + resp, err := l.GetCart(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/cart/listcartitemspagehandler.go b/internal/handler/mp/crm/trade/cart/listcartitemspagehandler.go new file mode 100644 index 00000000..43f36c90 --- /dev/null +++ b/internal/handler/mp/crm/trade/cart/listcartitemspagehandler.go @@ -0,0 +1,28 @@ +package cart + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/cart" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListCartItemsPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListCartItemsPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cart.NewListCartItemsPageLogic(r.Context(), svcCtx) + resp, err := l.ListCartItemsPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/cart/removecartitemhandler.go b/internal/handler/mp/crm/trade/cart/removecartitemhandler.go new file mode 100644 index 00000000..7c7384d8 --- /dev/null +++ b/internal/handler/mp/crm/trade/cart/removecartitemhandler.go @@ -0,0 +1,28 @@ +package cart + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/cart" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func RemoveCartItemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.RemoveCartItemRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cart.NewRemoveCartItemLogic(r.Context(), svcCtx) + resp, err := l.RemoveCartItem(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/cart/updatecartitemquantityhandler.go b/internal/handler/mp/crm/trade/cart/updatecartitemquantityhandler.go new file mode 100644 index 00000000..1cd48e6d --- /dev/null +++ b/internal/handler/mp/crm/trade/cart/updatecartitemquantityhandler.go @@ -0,0 +1,28 @@ +package cart + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/cart" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func UpdateCartItemQuantityHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdateCartItemQuantityRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := cart.NewUpdateCartItemQuantityLogic(r.Context(), svcCtx) + resp, err := l.UpdateCartItemQuantity(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/order/cancelorderhandler.go b/internal/handler/mp/crm/trade/order/cancelorderhandler.go new file mode 100644 index 00000000..540de16e --- /dev/null +++ b/internal/handler/mp/crm/trade/order/cancelorderhandler.go @@ -0,0 +1,28 @@ +package order + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/order" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func CancelOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CancelOrderRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := order.NewCancelOrderLogic(r.Context(), svcCtx) + resp, err := l.CancelOrder(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/order/createorderbycartitemshandler.go b/internal/handler/mp/crm/trade/order/createorderbycartitemshandler.go new file mode 100644 index 00000000..e67a1570 --- /dev/null +++ b/internal/handler/mp/crm/trade/order/createorderbycartitemshandler.go @@ -0,0 +1,28 @@ +package order + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/order" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func CreateOrderByCartItemsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateOrderByCartItemsRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := order.NewCreateOrderByCartItemsLogic(r.Context(), svcCtx) + resp, err := l.CreateOrderByCartItems(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/order/createorderbyproductshandler.go b/internal/handler/mp/crm/trade/order/createorderbyproductshandler.go new file mode 100644 index 00000000..42f0f40e --- /dev/null +++ b/internal/handler/mp/crm/trade/order/createorderbyproductshandler.go @@ -0,0 +1,28 @@ +package order + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/order" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func CreateOrderByProductsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreateOrderByProductsRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := order.NewCreateOrderByProductsLogic(r.Context(), svcCtx) + resp, err := l.CreateOrderByProducts(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/order/getorderhandler.go b/internal/handler/mp/crm/trade/order/getorderhandler.go new file mode 100644 index 00000000..f0231e47 --- /dev/null +++ b/internal/handler/mp/crm/trade/order/getorderhandler.go @@ -0,0 +1,28 @@ +package order + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/order" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetOrderRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := order.NewGetOrderLogic(r.Context(), svcCtx) + resp, err := l.GetOrder(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/order/listorderspagehandler.go b/internal/handler/mp/crm/trade/order/listorderspagehandler.go new file mode 100644 index 00000000..ba0181c8 --- /dev/null +++ b/internal/handler/mp/crm/trade/order/listorderspagehandler.go @@ -0,0 +1,28 @@ +package order + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/order" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListOrdersPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListOrdersPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := order.NewListOrdersPageLogic(r.Context(), svcCtx) + resp, err := l.ListOrdersPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/payment/createpaymentfromorderhandler.go b/internal/handler/mp/crm/trade/payment/createpaymentfromorderhandler.go new file mode 100644 index 00000000..94b0d5a6 --- /dev/null +++ b/internal/handler/mp/crm/trade/payment/createpaymentfromorderhandler.go @@ -0,0 +1,28 @@ +package payment + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/payment" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func CreatePaymentFromOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.CreatePaymentFromOrderRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := payment.NewCreatePaymentFromOrderLogic(r.Context(), svcCtx) + resp, err := l.CreatePaymentFromOrder(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/payment/getpaymenthandler.go b/internal/handler/mp/crm/trade/payment/getpaymenthandler.go new file mode 100644 index 00000000..8f1fb310 --- /dev/null +++ b/internal/handler/mp/crm/trade/payment/getpaymenthandler.go @@ -0,0 +1,28 @@ +package payment + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/payment" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func GetPaymentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.GetPaymentRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := payment.NewGetPaymentLogic(r.Context(), svcCtx) + resp, err := l.GetPayment(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/payment/listpaymentspagehandler.go b/internal/handler/mp/crm/trade/payment/listpaymentspagehandler.go new file mode 100644 index 00000000..387b8e1b --- /dev/null +++ b/internal/handler/mp/crm/trade/payment/listpaymentspagehandler.go @@ -0,0 +1,28 @@ +package payment + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/payment" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func ListPaymentsPageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.ListPaymentsPageRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := payment.NewListPaymentsPageLogic(r.Context(), svcCtx) + resp, err := l.ListPaymentsPage(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +} diff --git a/internal/handler/mp/crm/trade/payment/updatepaymenthandler.go b/internal/handler/mp/crm/trade/payment/updatepaymenthandler.go new file mode 100644 index 00000000..2b652514 --- /dev/null +++ b/internal/handler/mp/crm/trade/payment/updatepaymenthandler.go @@ -0,0 +1,28 @@ +package payment + +import ( + "net/http" + + "PowerX/internal/logic/mp/crm/trade/payment" + "PowerX/internal/svc" + "PowerX/internal/types" + "github.com/zeromicro/go-zero/rest/httpx" +) + +func UpdatePaymentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + var req types.UpdatePaymentRequest + if err := httpx.Parse(r, &req); err != nil { + httpx.ErrorCtx(r.Context(), w, err) + return + } + + l := payment.NewUpdatePaymentLogic(r.Context(), svcCtx) + resp, err := l.UpdatePayment(&req) + if err != nil { + httpx.ErrorCtx(r.Context(), w, err) + } else { + httpx.OkJsonCtx(r.Context(), w, resp) + } + } +}