docs(详细设计): 新增飞书通知设计

This commit is contained in:
2026-06-03 21:15:34 +08:00
parent cc200a32c4
commit 7a60af0485
7 changed files with 823 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
# 飞书回执记录Skill 设计
## 1. Skill 定位
`飞书回执记录Skill` 负责记录飞书消息发送结果、通知对象、消息 ID、失败原因和审计载荷。
英文实现标识建议使用 `FeishuReceiptRecordSkill`
## 2. 输入
```python
@dataclass
class FeishuReceiptRecordInput:
batch_id: int
send_result: dict
mention_targets: list[dict]
notification_payload: dict
trigger_context: dict
```
## 3. 输出
```python
@dataclass
class FeishuReceiptRecordOutput:
notification_record_id: int
audit_payload: dict
status: str
```
## 4. 核心方法
### 4.1 `run(input) -> FeishuReceiptRecordOutput`
主入口方法。
### 4.2 `create_notification_record(input) -> FeishuNotificationRecord`
创建通知记录。
### 4.3 `build_audit_payload(record) -> dict`
生成审计载荷。
### 4.4 `record_audit(payload) -> AuditLog`
写入审计。
## 5. 技术实现
使用技术:
1. Django ORM
2. JSONField
3. Audit 服务
## 6. 异常处理
1. 记录写入失败:返回系统错误。
2. 审计写入失败:保留通知记录并标记警告。
3. 发送失败:仍记录失败回执。
## 7. 测试要点
1. 成功发送可记录 message_id。
2. 失败发送可记录错误。
3. 审计载荷包含触发来源。
4. 提及用户列表可保存。