mirror of
https://github.com/hongguang1994/SimNexus.git
synced 2026-11-30 02:26:49 +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>
18 lines
766 B
Python
18 lines
766 B
Python
from datetime import datetime
|
|
from sqlalchemy import Column, Integer, String, Boolean, DateTime, Text
|
|
from app.core.database import Base
|
|
|
|
|
|
class Notification(Base):
|
|
__tablename__ = "notifications"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
type = Column(String(32), nullable=False)
|
|
title = Column(String(128), nullable=False)
|
|
body = Column(Text, nullable=False, default="")
|
|
is_read = Column(Boolean, default=False, nullable=False)
|
|
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
|
# audience: 'admin' = admin only, 'all' = everyone, 'user' = specific user
|
|
audience = Column(String(16), nullable=False, default="admin")
|
|
target_user_id = Column(Integer, nullable=True) # set when audience='user'
|