All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m30s
新增功能: - 门店套餐分配管理(shop_package_allocation):支持门店套餐库存管理 - 门店套餐系列分配管理(shop_series_allocation):支持套餐系列分配和佣金层级设置 - 我的套餐查询(my_package):支持门店查询自己的套餐分配情况 测试改进: - 统一集成测试基础设施,新增 testutils.NewIntegrationTestEnv - 重构所有集成测试使用新的测试环境设置 - 移除旧的测试辅助函数和冗余测试文件 - 新增 test_helpers_test.go 统一任务测试辅助 技术细节: - 新增数据库迁移 000025_create_shop_allocation_tables - 新增 3 个 Handler、Service、Store 和对应的单元测试 - 更新 OpenAPI 文档和文档生成器 - 测试覆盖率:Service 层 > 90% Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
90 lines
6.4 KiB
Go
90 lines
6.4 KiB
Go
package bootstrap
|
|
|
|
import (
|
|
accountSvc "github.com/break/junhong_cmp_fiber/internal/service/account"
|
|
assetAllocationRecordSvc "github.com/break/junhong_cmp_fiber/internal/service/asset_allocation_record"
|
|
authSvc "github.com/break/junhong_cmp_fiber/internal/service/auth"
|
|
carrierSvc "github.com/break/junhong_cmp_fiber/internal/service/carrier"
|
|
commissionWithdrawalSvc "github.com/break/junhong_cmp_fiber/internal/service/commission_withdrawal"
|
|
commissionWithdrawalSettingSvc "github.com/break/junhong_cmp_fiber/internal/service/commission_withdrawal_setting"
|
|
customerAccountSvc "github.com/break/junhong_cmp_fiber/internal/service/customer_account"
|
|
deviceSvc "github.com/break/junhong_cmp_fiber/internal/service/device"
|
|
deviceImportSvc "github.com/break/junhong_cmp_fiber/internal/service/device_import"
|
|
enterpriseSvc "github.com/break/junhong_cmp_fiber/internal/service/enterprise"
|
|
enterpriseCardSvc "github.com/break/junhong_cmp_fiber/internal/service/enterprise_card"
|
|
iotCardSvc "github.com/break/junhong_cmp_fiber/internal/service/iot_card"
|
|
iotCardImportSvc "github.com/break/junhong_cmp_fiber/internal/service/iot_card_import"
|
|
myCommissionSvc "github.com/break/junhong_cmp_fiber/internal/service/my_commission"
|
|
myPackageSvc "github.com/break/junhong_cmp_fiber/internal/service/my_package"
|
|
packageSvc "github.com/break/junhong_cmp_fiber/internal/service/package"
|
|
packageSeriesSvc "github.com/break/junhong_cmp_fiber/internal/service/package_series"
|
|
permissionSvc "github.com/break/junhong_cmp_fiber/internal/service/permission"
|
|
personalCustomerSvc "github.com/break/junhong_cmp_fiber/internal/service/personal_customer"
|
|
roleSvc "github.com/break/junhong_cmp_fiber/internal/service/role"
|
|
shopSvc "github.com/break/junhong_cmp_fiber/internal/service/shop"
|
|
shopAccountSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_account"
|
|
shopCommissionSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_commission"
|
|
shopPackageAllocationSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_package_allocation"
|
|
shopSeriesAllocationSvc "github.com/break/junhong_cmp_fiber/internal/service/shop_series_allocation"
|
|
)
|
|
|
|
type services struct {
|
|
Account *accountSvc.Service
|
|
Role *roleSvc.Service
|
|
Permission *permissionSvc.Service
|
|
PersonalCustomer *personalCustomerSvc.Service
|
|
Shop *shopSvc.Service
|
|
ShopAccount *shopAccountSvc.Service
|
|
Auth *authSvc.Service
|
|
ShopCommission *shopCommissionSvc.Service
|
|
CommissionWithdrawal *commissionWithdrawalSvc.Service
|
|
CommissionWithdrawalSetting *commissionWithdrawalSettingSvc.Service
|
|
Enterprise *enterpriseSvc.Service
|
|
EnterpriseCard *enterpriseCardSvc.Service
|
|
Authorization *enterpriseCardSvc.AuthorizationService
|
|
CustomerAccount *customerAccountSvc.Service
|
|
MyCommission *myCommissionSvc.Service
|
|
IotCard *iotCardSvc.Service
|
|
IotCardImport *iotCardImportSvc.Service
|
|
Device *deviceSvc.Service
|
|
DeviceImport *deviceImportSvc.Service
|
|
AssetAllocationRecord *assetAllocationRecordSvc.Service
|
|
Carrier *carrierSvc.Service
|
|
PackageSeries *packageSeriesSvc.Service
|
|
Package *packageSvc.Service
|
|
ShopSeriesAllocation *shopSeriesAllocationSvc.Service
|
|
ShopPackageAllocation *shopPackageAllocationSvc.Service
|
|
MyPackage *myPackageSvc.Service
|
|
}
|
|
|
|
func initServices(s *stores, deps *Dependencies) *services {
|
|
return &services{
|
|
Account: accountSvc.New(s.Account, s.Role, s.AccountRole),
|
|
Role: roleSvc.New(s.Role, s.Permission, s.RolePermission),
|
|
Permission: permissionSvc.New(s.Permission, s.AccountRole, s.RolePermission, deps.Redis),
|
|
PersonalCustomer: personalCustomerSvc.NewService(s.PersonalCustomer, s.PersonalCustomerPhone, deps.VerificationService, deps.JWTManager, deps.Logger),
|
|
Shop: shopSvc.New(s.Shop, s.Account),
|
|
ShopAccount: shopAccountSvc.New(s.Account, s.Shop),
|
|
Auth: authSvc.New(s.Account, s.AccountRole, s.RolePermission, s.Permission, deps.TokenManager, deps.Logger),
|
|
ShopCommission: shopCommissionSvc.New(s.Shop, s.Account, s.Wallet, s.CommissionWithdrawalRequest, s.CommissionRecord),
|
|
CommissionWithdrawal: commissionWithdrawalSvc.New(deps.DB, s.Shop, s.Account, s.Wallet, s.WalletTransaction, s.CommissionWithdrawalRequest),
|
|
CommissionWithdrawalSetting: commissionWithdrawalSettingSvc.New(deps.DB, s.Account, s.CommissionWithdrawalSetting),
|
|
Enterprise: enterpriseSvc.New(deps.DB, s.Enterprise, s.Shop, s.Account),
|
|
EnterpriseCard: enterpriseCardSvc.New(deps.DB, s.Enterprise, s.EnterpriseCardAuthorization),
|
|
Authorization: enterpriseCardSvc.NewAuthorizationService(s.Enterprise, s.IotCard, s.EnterpriseCardAuthorization, deps.Logger),
|
|
CustomerAccount: customerAccountSvc.New(deps.DB, s.Account, s.Shop, s.Enterprise),
|
|
MyCommission: myCommissionSvc.New(deps.DB, s.Shop, s.Wallet, s.CommissionWithdrawalRequest, s.CommissionWithdrawalSetting, s.CommissionRecord, s.WalletTransaction),
|
|
IotCard: iotCardSvc.New(deps.DB, s.IotCard, s.Shop, s.AssetAllocationRecord),
|
|
IotCardImport: iotCardImportSvc.New(deps.DB, s.IotCardImportTask, deps.QueueClient),
|
|
Device: deviceSvc.New(deps.DB, s.Device, s.DeviceSimBinding, s.IotCard, s.Shop, s.AssetAllocationRecord),
|
|
DeviceImport: deviceImportSvc.New(deps.DB, s.DeviceImportTask, deps.QueueClient),
|
|
AssetAllocationRecord: assetAllocationRecordSvc.New(deps.DB, s.AssetAllocationRecord, s.Shop, s.Account),
|
|
Carrier: carrierSvc.New(s.Carrier),
|
|
PackageSeries: packageSeriesSvc.New(s.PackageSeries),
|
|
Package: packageSvc.New(s.Package, s.PackageSeries),
|
|
ShopSeriesAllocation: shopSeriesAllocationSvc.New(s.ShopSeriesAllocation, s.ShopSeriesCommissionTier, s.Shop, s.PackageSeries, s.Package),
|
|
ShopPackageAllocation: shopPackageAllocationSvc.New(s.ShopPackageAllocation, s.ShopSeriesAllocation, s.Shop, s.Package),
|
|
MyPackage: myPackageSvc.New(s.ShopSeriesAllocation, s.ShopPackageAllocation, s.PackageSeries, s.Package, s.Shop),
|
|
}
|
|
}
|