sync: 同步 v1.0.4 并脱敏配置与镜像
This commit is contained in:
@@ -16,14 +16,23 @@ func notifyCutoffBatch(ctx context.Context, key cutoffBatchGroupKey, items []loc
|
||||
return
|
||||
}
|
||||
|
||||
deptName := cutoffDeptName(ctx, key.CreatedDept)
|
||||
deptNames := make(map[int64]string)
|
||||
events := make([]warningnotify.Event, 0, len(items))
|
||||
for _, item := range items {
|
||||
card := item.Card
|
||||
deptID := cutoffNotificationDeptID(card, key.CreatedDept)
|
||||
if card.DeptId <= 0 {
|
||||
g.Log().Warningf(ctx, "TrafficCutoff notify fallback to created dept because card dept is empty, cardId:%d, iccid:%s, createdDept:%d", card.Id, card.Iccid, key.CreatedDept)
|
||||
}
|
||||
deptName, ok := deptNames[deptID]
|
||||
if !ok {
|
||||
deptName = cutoffDeptName(ctx, deptID)
|
||||
deptNames[deptID] = deptName
|
||||
}
|
||||
events = append(events, warningnotify.Event{
|
||||
Business: warningnotify.BusinessTrafficCutoff,
|
||||
TenantID: key.TenantId,
|
||||
DeptID: key.CreatedDept,
|
||||
DeptID: deptID,
|
||||
DeptName: deptName,
|
||||
CreatedBy: key.CreatedBy,
|
||||
Category: "达量断网",
|
||||
@@ -51,6 +60,13 @@ func notifyCutoffBatch(ctx context.Context, key cutoffBatchGroupKey, items []loc
|
||||
}
|
||||
}
|
||||
|
||||
func cutoffNotificationDeptID(card cutoffCard, fallbackDeptID int64) int64 {
|
||||
if card.DeptId > 0 {
|
||||
return card.DeptId
|
||||
}
|
||||
return fallbackDeptID
|
||||
}
|
||||
|
||||
func cutoffDeptName(ctx context.Context, deptID int64) string {
|
||||
if deptID <= 0 {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user