package models import "time" // AlertOutbox 表示待发送或重试中的告警任务。 type AlertOutbox struct { ID uint `gorm:"primaryKey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` // LogEventID 关联日志事件 ID。 LogEventID uint `gorm:"index" json:"log_event_id"` // PayloadJSON 保存 AlertReceiveBody 的 JSON 文本。 PayloadJSON string `gorm:"type:text" json:"payload_json"` // Status 任务状态:pending/retrying/sent/dead。 Status string `gorm:"size:32;index" json:"status"` // RetryCount 已重试次数。 RetryCount int `json:"retry_count"` // NextRetryAt 下一次可重试时间。 NextRetryAt time.Time `gorm:"index" json:"next_retry_at"` // LastError 最近一次错误信息。 LastError string `gorm:"type:text" json:"last_error"` } func (AlertOutbox) TableName() string { return "logs_alert_outbox" }