From dd68d0a62b987303e2fd82b22beb317311ea9e99 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 4 Mar 2026 11:36:30 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=20Bootstrap=20?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=EF=BC=8C=E7=A7=BB=E9=99=A4=E6=97=A7=E5=88=86?= =?UTF-8?q?=E9=85=8D=E6=9C=8D=E5=8A=A1=EF=BC=8C=E6=8E=A5=E5=85=A5=E7=B3=BB?= =?UTF-8?q?=E5=88=97=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Types、Services、Handlers 三个文件同步:删除 ShopSeriesAllocation 和 ShopPackageAllocation 的 Handler/Service 字段及初始化逻辑,注册新的 ShopSeriesGrant Handler 和 Service。 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- internal/bootstrap/handlers.go | 3 +-- internal/bootstrap/services.go | 9 +++------ internal/bootstrap/types.go | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/internal/bootstrap/handlers.go b/internal/bootstrap/handlers.go index bb34192..b69f7de 100644 --- a/internal/bootstrap/handlers.go +++ b/internal/bootstrap/handlers.go @@ -42,10 +42,9 @@ func initHandlers(svc *services, deps *Dependencies) *Handlers { Package: admin.NewPackageHandler(svc.Package), PackageUsage: admin.NewPackageUsageHandler(svc.PackageDailyRecord), H5PackageUsage: h5.NewPackageUsageHandler(deps.DB, svc.PackageCustomerView), - ShopSeriesAllocation: admin.NewShopSeriesAllocationHandler(svc.ShopSeriesAllocation), - ShopPackageAllocation: admin.NewShopPackageAllocationHandler(svc.ShopPackageAllocation), ShopPackageBatchAllocation: admin.NewShopPackageBatchAllocationHandler(svc.ShopPackageBatchAllocation), ShopPackageBatchPricing: admin.NewShopPackageBatchPricingHandler(svc.ShopPackageBatchPricing), + ShopSeriesGrant: admin.NewShopSeriesGrantHandler(svc.ShopSeriesGrant), AdminOrder: admin.NewOrderHandler(svc.Order, validate), H5Order: h5.NewOrderHandler(svc.Order), H5Recharge: h5.NewRechargeHandler(svc.Recharge), diff --git a/internal/bootstrap/services.go b/internal/bootstrap/services.go index ea68cef..75287c2 100644 --- a/internal/bootstrap/services.go +++ b/internal/bootstrap/services.go @@ -32,10 +32,9 @@ import ( pollingSvc "github.com/break/junhong_cmp_fiber/internal/service/polling" shopCommissionSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_commission" - shopPackageAllocationSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_package_allocation" shopPackageBatchAllocationSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_package_batch_allocation" shopPackageBatchPricingSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_package_batch_pricing" - shopSeriesAllocationSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_series_allocation" + shopSeriesGrantSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_series_grant" ) type services struct { @@ -65,10 +64,9 @@ type services struct { Package *packageSvc.Service PackageDailyRecord *packageSvc.DailyRecordService PackageCustomerView *packageSvc.CustomerViewService - ShopSeriesAllocation *shopSeriesAllocationSvc.Service - ShopPackageAllocation *shopPackageAllocationSvc.Service ShopPackageBatchAllocation *shopPackageBatchAllocationSvc.Service ShopPackageBatchPricing *shopPackageBatchPricingSvc.Service + ShopSeriesGrant *shopSeriesGrantSvc.Service CommissionStats *commissionStatsSvc.Service PurchaseValidation *purchaseValidationSvc.Service Order *orderSvc.Service @@ -134,10 +132,9 @@ func initServices(s *stores, deps *Dependencies) *services { Package: packageSvc.New(s.Package, s.PackageSeries, s.ShopPackageAllocation, s.ShopSeriesAllocation), PackageDailyRecord: packageSvc.NewDailyRecordService(deps.DB, deps.Redis, s.PackageUsageDailyRecord, deps.Logger), PackageCustomerView: packageSvc.NewCustomerViewService(deps.DB, deps.Redis, s.PackageUsage, deps.Logger), - ShopSeriesAllocation: shopSeriesAllocationSvc.New(s.ShopSeriesAllocation, s.ShopPackageAllocation, s.Shop, s.PackageSeries), - ShopPackageAllocation: shopPackageAllocationSvc.New(s.ShopPackageAllocation, s.ShopSeriesAllocation, s.ShopPackageAllocationPriceHistory, s.Shop, s.Package, s.PackageSeries), ShopPackageBatchAllocation: shopPackageBatchAllocationSvc.New(deps.DB, s.Package, s.ShopPackageAllocation, s.ShopSeriesAllocation, s.Shop), ShopPackageBatchPricing: shopPackageBatchPricingSvc.New(deps.DB, s.ShopPackageAllocation, s.ShopPackageAllocationPriceHistory, s.Shop), + ShopSeriesGrant: shopSeriesGrantSvc.New(deps.DB, s.ShopSeriesAllocation, s.ShopPackageAllocation, s.ShopPackageAllocationPriceHistory, s.Shop, s.Package, s.PackageSeries, deps.Logger), CommissionStats: commissionStatsSvc.New(s.ShopSeriesCommissionStats), PurchaseValidation: purchaseValidation, Order: orderSvc.New(deps.DB, deps.Redis, s.Order, s.OrderItem, s.AgentWallet, s.CardWallet, purchaseValidation, s.ShopPackageAllocation, s.ShopSeriesAllocation, s.IotCard, s.Device, s.PackageSeries, s.PackageUsage, s.Package, deps.WechatPayment, deps.QueueClient, deps.Logger), diff --git a/internal/bootstrap/types.go b/internal/bootstrap/types.go index 0ce7e1e..0ed63e5 100644 --- a/internal/bootstrap/types.go +++ b/internal/bootstrap/types.go @@ -40,10 +40,9 @@ type Handlers struct { Package *admin.PackageHandler PackageUsage *admin.PackageUsageHandler H5PackageUsage *h5.PackageUsageHandler - ShopSeriesAllocation *admin.ShopSeriesAllocationHandler - ShopPackageAllocation *admin.ShopPackageAllocationHandler ShopPackageBatchAllocation *admin.ShopPackageBatchAllocationHandler ShopPackageBatchPricing *admin.ShopPackageBatchPricingHandler + ShopSeriesGrant *admin.ShopSeriesGrantHandler AdminOrder *admin.OrderHandler H5Order *h5.OrderHandler H5Recharge *h5.RechargeHandler