将账号、认证、管理员、分析、自动化、卡券、聊天、商品、关键词、设置和订单能力迁移到 application 与 adapter,删除 Server 内对应的旧仓储和业务服务实现,并收紧架构检查。 完善批量发布与订单刷新生命周期、凭证写回、账号任务补偿、订单 reconciliation、通知和敏感数据边界;补充正常、失败、取消、并发、越权及多方言回归测试,并修正 MySQL 延迟任务表的 InnoDB 配置。 修复空卡密响应为 null 时前端加载失败的问题,重建嵌入式前端资产;重写重构总计划,清除历史流水并明确阶段 1 至 10 各对应一次完整迭代和一个 PR。 验证:make check;make test-server-race;npm test/typecheck/comments:check/build;Docker SQLite/MySQL 8.4/PostgreSQL 17 TestMultiDB_*。
41 lines
1.5 KiB
Go
41 lines
1.5 KiB
Go
// Package automation 提供自动化业务用例的纯应用层编排。
|
|
package automation
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"strings"
|
|
)
|
|
|
|
// CredentialWakeRepository 定义凭证恢复后唤醒账号任务所需的最小端口。
|
|
type CredentialWakeRepository interface {
|
|
// WakeCredentialBlocked 唤醒指定账号因凭证失效而暂停的自动化任务。
|
|
WakeCredentialBlocked(context.Context, string) error
|
|
}
|
|
|
|
// CredentialWakeService 编排凭证恢复后的自动化任务唤醒,不依赖数据库或 HTTP 类型。
|
|
type CredentialWakeService struct {
|
|
// repository 提供自动化任务唤醒的持久化能力。
|
|
repository CredentialWakeRepository
|
|
}
|
|
|
|
// NewCredentialWakeService 构造凭证恢复唤醒应用服务并校验依赖。
|
|
func NewCredentialWakeService(repository CredentialWakeRepository) (*CredentialWakeService, error) {
|
|
if repository == nil {
|
|
return nil, errors.New("凭证恢复唤醒 repository 未初始化")
|
|
}
|
|
return &CredentialWakeService{repository: repository}, nil
|
|
}
|
|
|
|
// WakeCredentialBlocked 唤醒指定账号的凭证阻塞任务,并拒绝空账号标识。
|
|
func (s *CredentialWakeService) WakeCredentialBlocked(ctx context.Context, accountID string) error {
|
|
if s == nil || s.repository == nil {
|
|
return errors.New("凭证恢复唤醒服务未初始化")
|
|
}
|
|
accountID = strings.TrimSpace(accountID)
|
|
if accountID == "" {
|
|
return errors.New("账号标识不能为空")
|
|
}
|
|
return s.repository.WakeCredentialBlocked(ctx, accountID)
|
|
}
|