feat: integrate OA activation workflows and business migration
This commit is contained in:
@@ -97,7 +97,7 @@ func TestAlertV2ExemptionHistoryAndAutomaticRemoval(t *testing.T) {
|
||||
if err := db.Exec("INSERT INTO sys_user_bind_platform(user_id,source_db,platform_busier_id,status) VALUES(7,'lx',7,'0')").Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
r := NewAlertGovernanceRepo(testData{db})
|
||||
r := NewAlertGovernanceRepo(testData{db}, activationDatabases{db})
|
||||
ctx := context.Background()
|
||||
entry := &business.AlertExemption{ChannelKey: business.ChannelKey{SourceDB: "lx", ID: 1}, ChannelName: "父渠道", OwnerID: 7, AddedBy: 7, AddedName: "一级商务", AddedAt: now, Reason: "长期合作"}
|
||||
if err := r.AddExemption(ctx, business.UserScope{All: true}, entry.ChannelKey, func(*business.AlertExemptionTarget) (*business.AlertExemption, error) { return entry, nil }); err != nil {
|
||||
@@ -118,7 +118,16 @@ func TestAlertV2ExemptionHistoryAndAutomaticRemoval(t *testing.T) {
|
||||
if err != nil || written {
|
||||
t.Fatalf("免预警仍生成: %v %v", written, err)
|
||||
}
|
||||
// 父渠道自身近 30 天流水仅 100 元,满足激活池条件;子渠道流水不冒充它自身的流水。
|
||||
// 本地达到流失阈值不等于 OA 已入池;只有收到 OA 入池记录才移出豁免。
|
||||
if err := db.AutoMigrate(&activationPoolPO{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if rows, err := r.LostExemptions(ctx, business.AlertLossAt(now)); err != nil || len(rows) != 0 {
|
||||
t.Fatalf("未入池误清理: %v %v", rows, err)
|
||||
}
|
||||
if err := db.Create(&activationPoolPO{ID: 1, PromoteID: 1, PlatformName: "lx", CreatedAt: now}).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
uc := business.NewAlertGovernanceUsecase(r, nil)
|
||||
if err := uc.Reconcile(ctx, now); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user