虎牙精英宝典
This commit is contained in:
@@ -498,6 +498,10 @@ class HuyaTask(Base):
|
||||
ForeignKey("huya_accounts.id"), nullable=False
|
||||
)
|
||||
task_type: Mapped[str] = mapped_column(String(64), nullable=False, index=True)
|
||||
# 任务归属工作台;legacy 保留旧虎牙任务,elite 隔离精英宝典任务。
|
||||
handbook_scope: Mapped[str] = mapped_column(
|
||||
String(16), nullable=False, default="legacy", index=True
|
||||
)
|
||||
status: Mapped[str] = mapped_column(String(32), default="pending")
|
||||
message: Mapped[str] = mapped_column(String(512), default="")
|
||||
result: Mapped[dict | None] = mapped_column(JSON, nullable=True)
|
||||
@@ -508,6 +512,42 @@ class HuyaTask(Base):
|
||||
account: Mapped[HuyaAccount] = relationship("HuyaAccount", back_populates="tasks")
|
||||
|
||||
|
||||
class HuyaWorkbenchAccount(Base):
|
||||
"""用户在虎牙指定工作台中启用的账号。"""
|
||||
|
||||
__tablename__ = "huya_workbench_accounts"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=False, index=True)
|
||||
handbook_scope: Mapped[str] = mapped_column(String(16), nullable=False, index=True)
|
||||
account_id: Mapped[int] = mapped_column(ForeignKey("huya_accounts.id"), nullable=False, index=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=_utcnow)
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint(
|
||||
"user_id", "handbook_scope", "account_id",
|
||||
name="uq_huya_workbench_account",
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class HuyaWorkbench(Base):
|
||||
"""工作台配置哨兵,令空账号集合也能跨浏览器同步。"""
|
||||
|
||||
__tablename__ = "huya_workbenches"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=False, index=True)
|
||||
handbook_scope: Mapped[str] = mapped_column(String(16), nullable=False, index=True)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime, default=_utcnow, onupdate=_utcnow
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint("user_id", "handbook_scope", name="uq_huya_workbench"),
|
||||
)
|
||||
|
||||
|
||||
class HuyaConfig(Base):
|
||||
"""虎牙业务配置"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user