feat: 集成飞书通知和机器人对话系统
- 新增通知系统 (notifications 表、服务、API) - 新增飞书定时任务结果推送 (webhook + 应用消息) - 新增飞书应用消息发送服务 (feishu_app_service) - 新增飞书 WebSocket 长连接事件监听 (苹果应用) - 新增飞书账号绑定/解绑 API - 新增橙子飞书机器人 (独立 WS 连接,固定路由到橙子助手 Agent) - 执行记录添加 schedule_id,用户添加飞书绑定字段 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
24
backend/app/models/notification.py
Normal file
24
backend/app/models/notification.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""通知模型 — 用于定时任务结果推送及系统通知"""
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, String, Text, DateTime, ForeignKey, Boolean
|
||||
from sqlalchemy.dialects.mysql import CHAR
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class Notification(Base):
|
||||
"""系统通知 — 定时任务结果、告警、系统消息等"""
|
||||
__tablename__ = "notifications"
|
||||
|
||||
id = Column(CHAR(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
||||
user_id = Column(CHAR(36), ForeignKey("users.id"), nullable=False, index=True, comment="接收用户 ID")
|
||||
title = Column(String(200), nullable=False, comment="通知标题")
|
||||
content = Column(Text, nullable=True, comment="通知正文")
|
||||
category = Column(String(32), default="system", comment="分类: schedule/alert/system")
|
||||
ref_type = Column(String(32), nullable=True, comment="关联对象类型: schedule/execution")
|
||||
ref_id = Column(String(36), nullable=True, comment="关联对象 ID")
|
||||
is_read = Column(Boolean, default=False, comment="是否已读")
|
||||
created_at = Column(DateTime, default=datetime.utcnow, comment="创建时间")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Notification(id={self.id}, user_id={self.user_id}, title={self.title})>"
|
||||
Reference in New Issue
Block a user