fix: wire AssetLevelService into existing service constructors
This commit is contained in:
parent
bee30a1824
commit
2a0db41dbf
@ -132,11 +132,16 @@ func main() {
|
|||||||
userClient := assetClient.NewUserServiceClient(userServiceClient)
|
userClient := assetClient.NewUserServiceClient(userServiceClient)
|
||||||
logger.Logger.Info("User Service RPC client initialized")
|
logger.Logger.Info("User Service RPC client initialized")
|
||||||
|
|
||||||
|
// 创建 Provider 层实例(用于获取 AssetLevelService)
|
||||||
|
assetLevelProvider := provider.NewAssetLevelProvider(database.GetDB())
|
||||||
|
assetLevelSvc := assetLevelProvider.GetLevelService()
|
||||||
|
logger.Logger.Info("AssetLevelProvider initialized")
|
||||||
|
|
||||||
// 创建 Service 层实例
|
// 创建 Service 层实例
|
||||||
registryRepo := starbookRepo.NewAssetRegistryRepository(database.GetDB())
|
registryRepo := starbookRepo.NewAssetRegistryRepository(database.GetDB())
|
||||||
assetService := service.NewAssetService(assetRepo, mintOrderRepo, assetLikeRepo, userClient, database.GetDB(), registryRepo)
|
assetService := service.NewAssetService(assetRepo, mintOrderRepo, assetLikeRepo, userClient, database.GetDB(), registryRepo)
|
||||||
mintService := service.NewMintService(assetRepo, mintOrderRepo, userClient, database.GetDB(), config.GlobalAssetConfig, registryRepo, mintCostRepo, userMintCountRepo)
|
mintService := service.NewMintService(assetRepo, mintOrderRepo, userClient, database.GetDB(), config.GlobalAssetConfig, registryRepo, mintCostRepo, userMintCountRepo, assetLevelSvc)
|
||||||
assetLikeService := service.NewAssetLikeService(assetRepo, assetLikeRepo, database.GetDB())
|
assetLikeService := service.NewAssetLikeService(assetRepo, assetLikeRepo, database.GetDB(), assetLevelSvc)
|
||||||
rankingService := service.NewRankingService(rankingRepo, userClient)
|
rankingService := service.NewRankingService(rankingRepo, userClient)
|
||||||
materialService := service.NewMaterialService(materialRepo, relationRepo)
|
materialService := service.NewMaterialService(materialRepo, relationRepo)
|
||||||
logger.Logger.Info("Service layer initialized")
|
logger.Logger.Info("Service layer initialized")
|
||||||
|
|||||||
@ -17,6 +17,8 @@ import (
|
|||||||
pb "github.com/topfans/backend/pkg/proto/task"
|
pb "github.com/topfans/backend/pkg/proto/task"
|
||||||
pbGallery "github.com/topfans/backend/pkg/proto/gallery"
|
pbGallery "github.com/topfans/backend/pkg/proto/gallery"
|
||||||
pbUser "github.com/topfans/backend/pkg/proto/user"
|
pbUser "github.com/topfans/backend/pkg/proto/user"
|
||||||
|
assetLevelRepo "github.com/topfans/backend/services/assetService/repository"
|
||||||
|
assetLevelSvc "github.com/topfans/backend/services/assetService/service"
|
||||||
"github.com/topfans/backend/services/taskService/client"
|
"github.com/topfans/backend/services/taskService/client"
|
||||||
"github.com/topfans/backend/services/taskService/config"
|
"github.com/topfans/backend/services/taskService/config"
|
||||||
"github.com/topfans/backend/services/taskService/model"
|
"github.com/topfans/backend/services/taskService/model"
|
||||||
@ -105,9 +107,15 @@ func main() {
|
|||||||
logger.Logger.Info("Gallery RPC client initialized")
|
logger.Logger.Info("Gallery RPC client initialized")
|
||||||
|
|
||||||
// 6. Init services
|
// 6. Init services
|
||||||
|
// Create AssetLevelService for revenue calculations
|
||||||
|
assetLevelRepository := assetLevelRepo.NewAssetLevelRepository(db)
|
||||||
|
seasonRepository := assetLevelRepo.NewSeasonRepository(db)
|
||||||
|
seasonDecayConfigRepository := assetLevelRepo.NewSeasonDecayConfigRepository(db)
|
||||||
|
assetLevelService := assetLevelSvc.NewAssetLevelService(assetLevelRepository, seasonRepository, seasonDecayConfigRepository)
|
||||||
|
|
||||||
dailySvc := service.NewDailyTaskService(dailyRepo, userRPCClient)
|
dailySvc := service.NewDailyTaskService(dailyRepo, userRPCClient)
|
||||||
onboardingSvc := service.NewOnboardingService(onboardingRepo, dailyRepo, userRPCClient)
|
onboardingSvc := service.NewOnboardingService(onboardingRepo, dailyRepo, userRPCClient)
|
||||||
revenueSvc := service.NewRevenueService(revenueRepo, userRPCClient, galleryRPCClient)
|
revenueSvc := service.NewRevenueService(revenueRepo, userRPCClient, galleryRPCClient, assetLevelService)
|
||||||
logger.Logger.Info("Services initialized")
|
logger.Logger.Info("Services initialized")
|
||||||
|
|
||||||
// 7. Init worker(goroutine 中启动)
|
// 7. Init worker(goroutine 中启动)
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
pbCommon "github.com/topfans/backend/pkg/proto/common"
|
pbCommon "github.com/topfans/backend/pkg/proto/common"
|
||||||
"github.com/topfans/backend/pkg/logger"
|
"github.com/topfans/backend/pkg/logger"
|
||||||
|
"github.com/topfans/backend/pkg/models"
|
||||||
pb "github.com/topfans/backend/pkg/proto/task"
|
pb "github.com/topfans/backend/pkg/proto/task"
|
||||||
"github.com/topfans/backend/services/taskService/client"
|
"github.com/topfans/backend/services/taskService/client"
|
||||||
"github.com/topfans/backend/services/taskService/model"
|
"github.com/topfans/backend/services/taskService/model"
|
||||||
@ -25,7 +26,7 @@ type RevenueService interface {
|
|||||||
|
|
||||||
// AssetLevelService 资产等级服务接口(定义在assetService)
|
// AssetLevelService 资产等级服务接口(定义在assetService)
|
||||||
type AssetLevelService interface {
|
type AssetLevelService interface {
|
||||||
GetOrCreateRecord(assetID int64) (interface{}, error)
|
GetOrCreateRecord(assetID int64) (*models.AssetLevelRecord, error)
|
||||||
AddExhibitionHours(assetID int64, hours int) (string, bool, error)
|
AddExhibitionHours(assetID int64, hours int) (string, bool, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1259
docs/superpowers/plans/2026-05-25-asset-level-system.md
Normal file
1259
docs/superpowers/plans/2026-05-25-asset-level-system.md
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user