七月迭代短暂完结,还有很多后端的关键东西没有弄,这是一版赶时间做的东西
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m26s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m26s
This commit is contained in:
@@ -6,11 +6,15 @@ import (
|
||||
"go.uber.org/zap"
|
||||
"gorm.io/gorm"
|
||||
|
||||
packageExpiryApp "github.com/break/junhong_cmp_fiber/internal/application/packageexpiry"
|
||||
"github.com/break/junhong_cmp_fiber/internal/exporter"
|
||||
"github.com/break/junhong_cmp_fiber/internal/gateway"
|
||||
"github.com/break/junhong_cmp_fiber/internal/infrastructure/integrationlog"
|
||||
"github.com/break/junhong_cmp_fiber/internal/infrastructure/messaging/outbox"
|
||||
notification "github.com/break/junhong_cmp_fiber/internal/infrastructure/notification"
|
||||
packageExpiryInfra "github.com/break/junhong_cmp_fiber/internal/infrastructure/packageexpiry"
|
||||
"github.com/break/junhong_cmp_fiber/internal/polling"
|
||||
packageExpiryQuery "github.com/break/junhong_cmp_fiber/internal/query/packageexpiry"
|
||||
iot_card_svc "github.com/break/junhong_cmp_fiber/internal/service/iot_card"
|
||||
"github.com/break/junhong_cmp_fiber/internal/store/postgres"
|
||||
"github.com/break/junhong_cmp_fiber/internal/task"
|
||||
@@ -68,6 +72,7 @@ func (h *Handler) RegisterHandlers() *asynq.ServeMux {
|
||||
h.registerIotCardImportHandler()
|
||||
h.registerDeviceImportHandler()
|
||||
h.registerOrderPackageInvalidateHandler()
|
||||
h.registerAssetPackageBatchOrderHandler()
|
||||
h.registerExportHandlers()
|
||||
h.registerCommissionStatsHandlers()
|
||||
h.registerCommissionCalculationHandler()
|
||||
@@ -78,6 +83,7 @@ func (h *Handler) RegisterHandlers() *asynq.ServeMux {
|
||||
h.registerAlertCheckHandler()
|
||||
h.registerDataCleanupHandler()
|
||||
h.registerNotificationCleanupHandler()
|
||||
h.registerPackageExpiryReminderHandler()
|
||||
h.registerAutoPurchaseHandler()
|
||||
h.registerDailyTrafficFlushHandler()
|
||||
|
||||
@@ -119,6 +125,18 @@ func (h *Handler) registerOrderPackageInvalidateHandler() {
|
||||
h.logger.Info("注册订单套餐批量失效任务处理器", zap.String("task_type", constants.TaskTypeOrderPackageInvalidate))
|
||||
}
|
||||
|
||||
func (h *Handler) registerAssetPackageBatchOrderHandler() {
|
||||
handler := task.NewAssetPackageBatchOrderHandler(
|
||||
h.workerResult.Stores.AssetPackageBatchOrderTask,
|
||||
h.workerResult.Stores.Shop,
|
||||
h.workerResult.Services.AssetPackageOrderCreator,
|
||||
h.storage,
|
||||
h.logger,
|
||||
)
|
||||
h.mux.HandleFunc(constants.TaskTypeAssetPackageBatchOrder, handler.Handle)
|
||||
h.logger.Info("注册资产套餐批量订购任务处理器", zap.String("task_type", constants.TaskTypeAssetPackageBatchOrder))
|
||||
}
|
||||
|
||||
func (h *Handler) registerDeviceImportHandler() {
|
||||
deviceImportHandler := task.NewDeviceImportHandler(
|
||||
h.db,
|
||||
@@ -131,6 +149,7 @@ func (h *Handler) registerDeviceImportHandler() {
|
||||
h.workerResult.Stores.AssetIdentifier,
|
||||
h.storage,
|
||||
h.logger,
|
||||
h.workerResult.Services.DeviceBatchAllocator,
|
||||
)
|
||||
|
||||
h.mux.HandleFunc(constants.TaskTypeDeviceImport, deviceImportHandler.HandleDeviceImport)
|
||||
@@ -284,6 +303,15 @@ func (h *Handler) registerNotificationCleanupHandler() {
|
||||
h.logger.Info("注册站内通知保留清理任务处理器", zap.String("task_type", constants.TaskTypeNotificationCleanup))
|
||||
}
|
||||
|
||||
func (h *Handler) registerPackageExpiryReminderHandler() {
|
||||
query := packageExpiryQuery.NewQuery(h.db)
|
||||
publisher := packageExpiryInfra.NewReminderPublisher(h.db, outbox.NewRepository())
|
||||
service := packageExpiryApp.NewReminderService(query, publisher)
|
||||
handler := task.NewPackageExpiryReminderHandler(service, h.logger)
|
||||
h.mux.HandleFunc(constants.TaskTypePackageExpiryReminder, handler.Handle)
|
||||
h.logger.Info("注册套餐临期节点提醒任务处理器", zap.String("task_type", constants.TaskTypePackageExpiryReminder))
|
||||
}
|
||||
|
||||
func (h *Handler) registerAutoPurchaseHandler() {
|
||||
autoPurchaseHandler := task.NewAutoPurchaseHandler(
|
||||
h.db,
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
packagepkg "github.com/break/junhong_cmp_fiber/internal/service/package"
|
||||
pollingSvc "github.com/break/junhong_cmp_fiber/internal/service/polling"
|
||||
"github.com/break/junhong_cmp_fiber/internal/store/postgres"
|
||||
"github.com/break/junhong_cmp_fiber/internal/task"
|
||||
)
|
||||
|
||||
// OrderExpirer 订单超时取消接口
|
||||
@@ -21,6 +22,7 @@ type OrderExpirer interface {
|
||||
// WorkerStores Worker 侧所有 Store 的集合
|
||||
type WorkerStores struct {
|
||||
AssetOperationLog *postgres.AssetOperationLogStore
|
||||
AssetAllocationRecord *postgres.AssetAllocationRecordStore
|
||||
IotCardImportTask *postgres.IotCardImportTaskStore
|
||||
IotCard *postgres.IotCardStore
|
||||
DeviceImportTask *postgres.DeviceImportTaskStore
|
||||
@@ -50,22 +52,25 @@ type WorkerStores struct {
|
||||
PersonalCustomer *postgres.PersonalCustomerStore
|
||||
PersonalCustomerPhone *postgres.PersonalCustomerPhoneStore
|
||||
OrderPackageInvalidateTask *postgres.OrderPackageInvalidateTaskStore
|
||||
AssetPackageBatchOrderTask *postgres.AssetPackageBatchOrderTaskStore
|
||||
}
|
||||
|
||||
// WorkerServices Worker 侧所有 Service 的集合
|
||||
type WorkerServices struct {
|
||||
CardObservation *cardObservationApp.Service
|
||||
CardObservationSeries *cardObservationApp.SeriesAttemptService
|
||||
ObservationSeriesEvents cardObservationApp.SeriesEventWriter
|
||||
CommissionCalculation *commission_calculation.Service
|
||||
CommissionStats *commission_stats.Service
|
||||
UsageService *packagepkg.UsageService
|
||||
ActivationService *packagepkg.ActivationService
|
||||
ResetService *packagepkg.ResetService
|
||||
AlertService *pollingSvc.AlertService
|
||||
CleanupService *pollingSvc.CleanupService
|
||||
StopResumeService packagepkg.StopResumeCallback // 停复机服务,用于注入 Scheduler
|
||||
OrderExpirer OrderExpirer // 订单超时取消服务(接口类型,避免循环依赖)
|
||||
CardObservation *cardObservationApp.Service
|
||||
CardObservationSeries *cardObservationApp.SeriesAttemptService
|
||||
ObservationSeriesEvents cardObservationApp.SeriesEventWriter
|
||||
CommissionCalculation *commission_calculation.Service
|
||||
CommissionStats *commission_stats.Service
|
||||
UsageService *packagepkg.UsageService
|
||||
ActivationService *packagepkg.ActivationService
|
||||
ResetService *packagepkg.ResetService
|
||||
AlertService *pollingSvc.AlertService
|
||||
CleanupService *pollingSvc.CleanupService
|
||||
StopResumeService packagepkg.StopResumeCallback // 停复机服务,用于注入 Scheduler
|
||||
OrderExpirer OrderExpirer // 订单超时取消服务(接口类型,避免循环依赖)
|
||||
AssetPackageOrderCreator task.AssetPackageBatchOrderCreator // 批量订购复用后台单笔订单规则
|
||||
DeviceBatchAllocator task.DeviceBatchAllocationExecutor // 设备CSV批量分配复用现有业务规则
|
||||
}
|
||||
|
||||
// WorkerBootstrapResult Worker Bootstrap 结果
|
||||
|
||||
Reference in New Issue
Block a user