mirror of
https://github.com/hongguang1994/SimNexus.git
synced 2026-11-25 15:11:45 +08:00
- 新增 RBAC 角色管理:roles 表 + user_roles 多对多,支持每用户分配多个角色,权限取并集 - 新增客服角色(can_support),可代替管理员回复用户咨询 - 通知系统新增 support audience,按角色路由(admin/support/all/user) - 登录页新增 SVG 验证码(JWT 签名,无服务端 session) - 前端新增多语言(zh/en)和主题(light/dark/system)支持 - 系统预置 5 个角色:全功能用户、只读用户、短信操作员、任务管理员、客服 - 新增页面:Roles、SupportAdmin、AdminTasks;用户管理支持多角色分配 - 更新 README.md 和 CLAUDE.md 覆盖所有新功能和架构说明 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
1012 B
Python
24 lines
1012 B
Python
from datetime import datetime
|
|
from sqlalchemy import Column, Integer, Text, Boolean, DateTime, ForeignKey
|
|
from sqlalchemy.orm import relationship
|
|
from app.core.database import Base
|
|
|
|
|
|
class SupportMessage(Base):
|
|
__tablename__ = "support_messages"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
sender_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
content = Column(Text, nullable=False, default="")
|
|
is_from_user = Column(Boolean, nullable=False)
|
|
is_read = Column(Boolean, default=False, nullable=False)
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
# Attachment fields (nullable)
|
|
attachment_url = Column(Text, nullable=True)
|
|
attachment_name = Column(Text, nullable=True)
|
|
attachment_type = Column(Text, nullable=True) # "image" | "file"
|
|
|
|
user = relationship("User", foreign_keys=[user_id])
|
|
sender = relationship("User", foreign_keys=[sender_id])
|