""" API Nonce防重放模型 """ from datetime import datetime from app.utils.timezone import beijing_now_naive from sqlalchemy import Column, Integer, String, DateTime, Boolean, Text from app.database import Base class APINonce(Base): """API Nonce防重放表""" __tablename__ = "api_nonces" id = Column(Integer, primary_key=True, autoincrement=True, comment="主键ID") nonce = Column(String(64), unique=True, nullable=False, comment="随机字符串") endpoint = Column(String(255), nullable=False, comment="接口路径") session_id = Column(String(64), nullable=True, comment="会话ID") user_id = Column(Integer, nullable=True, comment="用户ID") expires_at = Column(DateTime, nullable=False, comment="过期时间") created_at = Column(DateTime, default=beijing_now_naive, comment="创建时间") def __repr__(self): return f""