Version: 0.9.68.dev.260504

后端:
1. 阶段 3 notification 服务边界落地,新增 `cmd/notification`、`services/notification`、`gateway/notification`、`shared/contracts/notification` 和 notification port,按 userauth 同款最小手搓 zrpc 样板收口
2. notification outbox consumer、relay 和 retry loop 迁入独立服务入口,处理 `notification.feishu.requested`,gateway 改为通过 zrpc client 调用 notification
3. 清退旧单体 notification DAO/model/service/provider/runner 和 `service/events/notification_feishu.go`,旧实现不再作为活跃编译路径
4. 修复 outbox 路由归属、dispatch 启动扫描、Kafka topic 探测/投递超时、sending 租约恢复、毒消息 MarkDead 错误回传和 RPC timeout 边界
5. 同步调整 active-scheduler 触发通知事件、核心 outbox handler、MySQL 迁移边界和 notification 配置

文档:
1. 更新微服务迁移计划,将阶段 3 notification 标记为已完成,并明确下一阶段从 active-scheduler 开始
This commit is contained in:
Losita
2026-05-04 18:40:39 +08:00
parent 9742dc8b1c
commit abe3b4960e
41 changed files with 2178 additions and 889 deletions

View File

@@ -0,0 +1,41 @@
package model
import "time"
const (
// ChannelFeishuWebhook 表示用户配置的是飞书 Webhook 触发器。
ChannelFeishuWebhook = "feishu_webhook"
)
const (
// AuthTypeNone 表示 webhook 不需要额外鉴权头。
AuthTypeNone = "none"
// AuthTypeBearer 表示 webhook 需要 Authorization: Bearer token。
AuthTypeBearer = "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" }