优化结构

This commit is contained in:
Yvan
2026-08-22 15:53:14 +08:00
parent ca52de5db0
commit 491ed21d48
72 changed files with 746 additions and 695 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ import (
"kra/internal/app"
"kra/internal/biz"
systembiz "kra/internal/biz/system"
taskbiz "kra/internal/biz/task"
"kra/internal/conf"
"kra/internal/data"
"kra/internal/initialize"
@@ -46,7 +46,7 @@ func wireApp(*conf.Server, *conf.Runtime, *slog.Logger, *logging.ReloadableLogge
wire.Bind(new(initialize.Backend), new(*data.Data)),
wire.Bind(new(cache.RedisProvider), new(*data.Data)),
wire.Bind(new(middleware.TokenAuthenticator), new(*service.AuthService)),
wire.Bind(new(systembiz.TaskMethodRegistry), new(*platformtask.Registry)),
wire.Bind(new(taskbiz.TaskMethodRegistry), new(*platformtask.Registry)),
biz.ProviderSet,
service.ProviderSet,
newApp,
+9 -6
View File
@@ -9,7 +9,10 @@ package main
import (
"github.com/go-kratos/kratos/v3"
"kra/internal/app"
integration2 "kra/internal/biz/integration"
payment2 "kra/internal/biz/payment"
system2 "kra/internal/biz/system"
"kra/internal/biz/task"
"kra/internal/conf"
"kra/internal/data"
"kra/internal/data/payment"
@@ -97,20 +100,20 @@ func wireApp(confServer *conf.Server, runtime *conf.Runtime, logger *slog.Logger
handlerEmail := handler.NewEmail(emailService)
paymentRepo := payment.NewPaymentRepo(dataData)
paymentOrderRepo := payment.NewPaymentOrderRepo(dataData)
paymentUsecase := system2.NewPaymentUsecase(paymentRepo, paymentOrderRepo, logger)
paymentUsecase := payment2.NewPaymentUsecase(paymentRepo, paymentOrderRepo, logger)
paymentService := service.NewPaymentService(paymentUsecase)
handlerPayment := handler.NewPayment(paymentService)
taskRepo := system.NewTaskRepo(dataData)
registry := app.TaskRegistry(catalog)
taskUsecase := system2.NewTaskUsecaseWithRegistry(taskRepo, registry)
taskUsecase := task.NewTaskUsecaseWithRegistry(taskRepo, registry)
mediaRepo := system.NewMediaRepo(dataData)
mediaUsecase := system2.NewMediaUsecase(mediaRepo, reloadable, runtimeSettings)
taskExecutor := worker.NewTaskExecutorWithRegistry(taskUsecase, mediaUsecase, runtime, registry)
taskScheduler := worker.NewTaskScheduler(taskUsecase, authorityUsecase, taskExecutor, logger)
taskRuntime := worker.NewTaskRuntime(taskScheduler)
taskApplicationUsecase := system2.NewTaskApplicationUsecase(taskUsecase, taskRuntime)
taskApplicationUsecase := task.NewTaskApplicationUsecase(taskUsecase, taskRuntime)
taskService := service.NewTaskService(taskApplicationUsecase)
task := handler.NewTask(taskService)
handlerTask := handler.NewTask(taskService)
mediaService := service.NewMediaService(mediaUsecase, runtimeSettings)
media := handler.NewMedia(mediaService)
auditQueryRepo := system.NewAuditRepo(dataData)
@@ -151,10 +154,10 @@ func wireApp(confServer *conf.Server, runtime *conf.Runtime, logger *slog.Logger
integrationConfigRepo := system.NewIntegrationConfigRepo(dataData)
store := data.NewIntegrationRuntime(dataData)
connectivityTester := integration.NewConnectivityTester(store)
integrationConfigUsecase := system2.NewIntegrationConfigUsecase(integrationConfigRepo, connectivityTester)
integrationConfigUsecase := integration2.NewIntegrationConfigUsecase(integrationConfigRepo, connectivityTester)
integrationConfigService := service.NewIntegrationConfigService(integrationConfigUsecase)
integrationConfig := handler.NewIntegrationConfig(integrationConfigService)
v := handler.NewSet(authority, menu, api, permission, organization, announcement, handlerEmail, handlerPayment, task, media, audit, export, version, dictionary, parameter, apiToken, systemConfig, public, user, navigation, session, integrationConfig)
v := handler.NewSet(authority, menu, api, permission, organization, announcement, handlerEmail, handlerPayment, handlerTask, media, audit, export, version, dictionary, parameter, apiToken, systemConfig, public, user, navigation, session, integrationConfig)
routes := router.NewRoutes(v)
taskMethods := worker.NewTaskMethods(taskUsecase, mediaUsecase, runtime)
appRuntimeContributions := runtimeContributions(routes, taskMethods)