steam_account.py 1.2 KB

123456789101112131415161718192021222324
  1. """
  2. Steam账号模型(精简版)
  3. 仅记录用户与Steam账号的绑定关系,密码/mafile/session 等存于客户端本地。
  4. """
  5. from app.utils.timezone import beijing_now_naive
  6. from sqlalchemy import Column, Integer, String, DateTime, Boolean
  7. from app.database import Base
  8. class SteamAccount(Base):
  9. """Steam账号绑定表"""
  10. __tablename__ = "steam_accounts"
  11. id = Column(Integer, primary_key=True, autoincrement=True, comment="主键ID")
  12. user_id = Column(Integer, nullable=False, comment="用户ID")
  13. steam_username = Column(String(100), nullable=False, comment="Steam用户名")
  14. steam_id = Column(String(64), nullable=True, comment="Steam ID(来自登录验证)")
  15. is_active = Column(Boolean, default=True, comment="是否启用")
  16. is_deleted = Column(Boolean, default=False, comment="是否删除: 0-否, 1-是")
  17. created_at = Column(DateTime, default=beijing_now_naive, comment="创建时间")
  18. updated_at = Column(DateTime, default=beijing_now_naive, onupdate=beijing_now_naive, comment="更新时间")
  19. def __repr__(self):
  20. return f"<SteamAccount(id={self.id}, user_id={self.user_id}, steam_username='{self.steam_username}')>"