Version: 0.9.60.dev.260430

后端:
1.接入主动调度 worker 与飞书通知链路
- 新增 due job scanner 与 active_schedule.triggered workflow
- 接入 notification.feishu.requested handler、飞书 webhook provider 和用户通知配置接口
- 支持 notification_records 去重、重试、skipped/dead 状态流转
- 完成 api / worker / all 启动模式装配与主动调度验收记录
2.后续要做的就是补全从异常发生到给用户推送消息之间的逻辑缺口
This commit is contained in:
Losita
2026-04-30 23:45:27 +08:00
parent e945578fbf
commit 0a014f7472
26 changed files with 3636 additions and 55 deletions

View File

@@ -0,0 +1,43 @@
package model
import (
"time"
)
const (
// NotificationChannelFeishuWebhook 表示用户配置的是飞书 Webhook 触发器。
NotificationChannelFeishuWebhook = "feishu_webhook"
)
const (
// NotificationAuthTypeNone 表示 webhook 不需要额外鉴权头。
NotificationAuthTypeNone = "none"
// NotificationAuthTypeBearer 表示 webhook 需要 Authorization: Bearer token。
NotificationAuthTypeBearer = "bearer"
)
// UserNotificationChannel 保存单个用户的外部通知通道配置。
//
// 职责边界:
// 1. 只记录 user_id 到具体通知 provider 配置的映射;
// 2. 不记录 notification_records 投递状态,投递状态仍属于 NotificationRecord
// 3. 当前 webhook_url / bearer_token 暂以明文字段承载,接口和日志必须脱敏;后续接入统一密钥加密能力后再替换存储实现。
type UserNotificationChannel struct {
ID int64 `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserID int `gorm:"column:user_id;not null;uniqueIndex:uk_user_notification_channel,priority:1;index:idx_user_notification_channel_user"`
Channel string `gorm:"column:channel;type:varchar(32);not null;uniqueIndex:uk_user_notification_channel,priority:2"`
Enabled bool `gorm:"column:enabled;not null;default:true"`
WebhookURL string `gorm:"column:webhook_url;type:text;not null"`
AuthType string `gorm:"column:auth_type;type:varchar(32);not null;default:'none'"`
BearerToken string `gorm:"column:bearer_token;type:text;not null"`
LastTestStatus string `gorm:"column:last_test_status;type:varchar(32)"`
LastTestError string `gorm:"column:last_test_error;type:text"`
LastTestAt *time.Time `gorm:"column:last_test_at"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime"`
}
func (UserNotificationChannel) TableName() string { return "user_notification_channels" }