1
This commit is contained in:
@@ -114,3 +114,37 @@ class Series(Base):
|
||||
Index("idx_series_cat_status", "category_id", "status"),
|
||||
Index("idx_series_status_created", "status", "created_at"),
|
||||
)
|
||||
|
||||
|
||||
class CollectionRecord(Base):
|
||||
"""采集记录:外部内容源 → 本站系列的映射(幂等导入)"""
|
||||
|
||||
__tablename__ = "collection_records"
|
||||
|
||||
id: Mapped[int] = mapped_column(BIGINT(unsigned=True), primary_key=True, autoincrement=True)
|
||||
source_key: Mapped[str] = mapped_column(String(50), comment="内容源标识")
|
||||
source_id: Mapped[int] = mapped_column(BIGINT(unsigned=True), comment="源站内容 id")
|
||||
series_id: Mapped[int | None] = mapped_column(BIGINT(unsigned=True), comment="本站系列 id")
|
||||
video_id: Mapped[int | None] = mapped_column(BIGINT(unsigned=True), comment="本站视频 id(单视频类)")
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
__table_args__ = (
|
||||
Index("uk_source", "source_key", "source_id", unique=True),
|
||||
Index("idx_record_series", "series_id"),
|
||||
Index("idx_record_video", "video_id"),
|
||||
)
|
||||
|
||||
|
||||
class CollectionSource(Base):
|
||||
"""采集源配置:分类名 + 列表URL模板(后台自助添加)"""
|
||||
|
||||
__tablename__ = "collection_sources"
|
||||
|
||||
id: Mapped[int] = mapped_column(BIGINT(unsigned=True), primary_key=True, autoincrement=True)
|
||||
name: Mapped[str] = mapped_column(String(50), comment="分类名")
|
||||
list_url: Mapped[str] = mapped_column(String(500), comment="列表URL模板,{{page}}为页码占位")
|
||||
category_id: Mapped[int] = mapped_column(INTEGER(unsigned=True), comment="本站分类 id")
|
||||
status: Mapped[int] = mapped_column(SmallInteger, default=1, comment="1启用 0停用")
|
||||
last_sync_at: Mapped[datetime | None] = mapped_column(DateTime)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now(), onupdate=func.now())
|
||||
|
||||
Reference in New Issue
Block a user