File size: 1,925 Bytes
32ddb29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from datetime import datetime

from sqlalchemy import Boolean, DateTime, Integer, String, Text, func
from sqlalchemy.orm import Mapped, mapped_column

from app.database import Base


class SourceSite(Base):
    __tablename__ = "source_site"

    id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
    name: Mapped[str] = mapped_column(String(50), nullable=False, comment="站点名称")
    code: Mapped[str] = mapped_column(String(30), unique=True, nullable=False, comment="站点编码")
    base_url: Mapped[str] = mapped_column(String(500), nullable=False, comment="API基础地址")
    site_url: Mapped[str | None] = mapped_column(String(500), comment="官网地址")
    play_from_m3u8: Mapped[str | None] = mapped_column(String(30), comment="M3U8来源标识")
    play_from_yun: Mapped[str | None] = mapped_column(String(30), comment="云播来源标识")
    parse_url: Mapped[str | None] = mapped_column(String(500), comment="M3U8解析接口")
    is_active: Mapped[bool] = mapped_column(Boolean, default=True, comment="是否启用")
    sync_interval: Mapped[int] = mapped_column(Integer, default=60, comment="同步间隔(分钟)")
    last_sync_at: Mapped[datetime | None] = mapped_column(DateTime, comment="最后同步时间")
    last_sync_status: Mapped[str | None] = mapped_column(String(20), comment="最后同步状态")
    last_sync_count: Mapped[int] = mapped_column(Integer, default=0, comment="最后同步新增数量")
    total_count: Mapped[int] = mapped_column(Integer, default=0, comment="资源总数")
    sort_order: Mapped[int] = mapped_column(Integer, default=0, comment="排序权重")
    remark: Mapped[str | None] = mapped_column(String(200), comment="备注")
    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())