feat: implement V2 alert center and scoped alert governance

This commit is contained in:
Yvan
2026-11-05 20:08:29 +08:00
parent f8e26c5baf
commit 999c9a6315
57 changed files with 2711 additions and 216 deletions
+45
View File
@@ -0,0 +1,45 @@
package dto
import "encoding/json"
type AlertChannelOption struct {
ID uint64 `json:"id,string"`
SourceDB string `json:"sourceDb"`
Account string `json:"account"`
}
type AlertIgnoreRequest struct {
IDs []json.Number `json:"ids"`
}
type AlertGapRequest struct {
Enabled bool `json:"enabled"`
Days int `json:"days"`
}
type AlertExemptionQuery struct {
Page int `form:"pageNum"`
PageSize int `form:"pageSize"`
Name string `form:"channelName"`
Active *bool `form:"active"`
}
type AlertExemptionRequest struct {
SourceDB string `json:"sourceDb"`
PromoteID json.Number `json:"promoteId"`
Reason string `json:"reason"`
}
type AlertExemptionResponse struct {
ID uint64 `json:"id,string"`
SourceDB string `json:"sourceDb"`
PromoteID uint64 `json:"promoteId,string"`
ChannelName string `json:"channelName"`
AddedName string `json:"addedName"`
AddedAt *string `json:"addedAt"`
Reason string `json:"reason"`
Active bool `json:"active"`
RemovedName string `json:"removedName"`
RemovedAt *string `json:"removedAt"`
RemoveReason string `json:"removeReason"`
}
type AlertExemptionPage struct {
Rows []*AlertExemptionResponse `json:"rows"`
Total int64 `json:"total"`
}
+16 -11
View File
@@ -3,6 +3,8 @@ package dto
import "encoding/json"
type AlertRecordQuery struct {
AlertContent string `form:"alertContent"`
Lost *bool `form:"lost"`
Page int `form:"pageNum"`
PageSize int `form:"pageSize"`
PlatformCodes string `form:"platformCodes"`
@@ -29,18 +31,21 @@ type AlertNoteRequest struct {
}
type AlertRecordResponse struct {
ID uint64 `json:"id,string"`
PlatformCode string `json:"platformCode"`
PlatformName string `json:"platformName"`
RuleID uint64 `json:"ruleId,string"`
RuleName string `json:"ruleName"`
RuleType string `json:"ruleType"`
RuleTypeLabel string `json:"ruleTypeLabel"`
MonitorMetric *int `json:"monitorMetric"`
MonitorMetricLabel string `json:"monitorMetricLabel"`
// 旧视图声明了颜色,但记录没有对应快照字段,保留空值。
TotalPlayers *int64 `json:"totalPlayers"`
TotalPay *string `json:"totalPay"`
Lost *bool `json:"lost"`
ID uint64 `json:"id,string"`
PlatformCode string `json:"platformCode"`
PlatformName string `json:"platformName"`
RuleID uint64 `json:"ruleId,string"`
RuleName string `json:"ruleName"`
RuleType string `json:"ruleType"`
RuleTypeLabel string `json:"ruleTypeLabel"`
MonitorMetric *int `json:"monitorMetric"`
MonitorMetricLabel string `json:"monitorMetricLabel"`
// 历史记录无快照时返回 null,不回填当前数值。
WarningColor *string `json:"warningColor"`
TargetPromoteID uint64 `json:"targetPromoteId"`
TargetPromoteID uint64 `json:"targetPromoteId,string"`
TargetPromoteName string `json:"targetPromoteName"`
BusinessID uint `json:"businessId"`
BusinessName string `json:"businessName"`
+16 -10
View File
@@ -10,18 +10,24 @@ type AlertRuleQuery struct {
MonitorMetric string `form:"monitorMetric"`
}
type AlertRuleRequest struct {
ID uint64 `json:"id"`
RuleName string `json:"ruleName"`
RuleType string `json:"ruleType"`
MonitorMetric int `json:"monitorMetric"`
StatPeriodDays *int `json:"statPeriodDays"`
MomDirection *int `json:"momDirection"`
MomThreshold *json.Number `json:"momThreshold"`
UnloginDays *int `json:"unloginDays"`
WarningColor string `json:"warningColor"`
ConditionMode int `json:"conditionMode"`
AmountDirection int `json:"amountDirection"`
AmountThreshold *json.Number `json:"amountThreshold"`
ID json.Number `json:"id"`
RuleName string `json:"ruleName"`
RuleType string `json:"ruleType"`
MonitorMetric int `json:"monitorMetric"`
StatPeriodDays *int `json:"statPeriodDays"`
MomDirection *int `json:"momDirection"`
MomThreshold *json.Number `json:"momThreshold"`
UnloginDays *int `json:"unloginDays"`
WarningColor string `json:"warningColor"`
}
type AlertRuleResponse struct {
ID uint64 `json:"id"`
ConditionMode int `json:"conditionMode"`
AmountDirection int `json:"amountDirection"`
AmountThreshold *string `json:"amountThreshold"`
ID uint64 `json:"id,string"`
RuleName string `json:"ruleName"`
RuleType string `json:"ruleType"`
RuleTypeLabel string `json:"ruleTypeLabel"`