- 完成 T-001A: 前端项目初始化 (Next.js 14 + TypeScript + Tailwind CSS) - 完成 T-001B: 后端项目初始化 (FastAPI + SQLAlchemy + asyncpg) - 完成 T-002: 数据库配置 (KolVideo 模型 + 索引 + 测试) - 完成 T-003: 基础 UI 框架 (Header/Footer 组件 + 品牌色系) - 完成 T-004: 环境变量配置 (前后端环境变量) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
from sqlalchemy import Column, String, Integer, Float, DateTime, Index
|
|
from app.database import Base
|
|
|
|
|
|
class KolVideo(Base):
|
|
"""KOL 视频数据模型."""
|
|
|
|
__tablename__ = "kol_videos"
|
|
|
|
# 主键
|
|
item_id = Column(String, primary_key=True)
|
|
|
|
# 基础信息
|
|
title = Column(String, nullable=True)
|
|
viral_type = Column(String, nullable=True)
|
|
video_url = Column(String, nullable=True)
|
|
star_id = Column(String, nullable=False)
|
|
star_unique_id = Column(String, nullable=False)
|
|
star_nickname = Column(String, nullable=False)
|
|
publish_time = Column(DateTime, nullable=True)
|
|
|
|
# 曝光指标
|
|
natural_play_cnt = Column(Integer, default=0)
|
|
heated_play_cnt = Column(Integer, default=0)
|
|
total_play_cnt = Column(Integer, default=0)
|
|
|
|
# 互动指标
|
|
total_interact = Column(Integer, default=0)
|
|
like_cnt = Column(Integer, default=0)
|
|
share_cnt = Column(Integer, default=0)
|
|
comment_cnt = Column(Integer, default=0)
|
|
|
|
# 效果指标
|
|
new_a3_rate = Column(Float, nullable=True)
|
|
after_view_search_uv = Column(Integer, default=0)
|
|
return_search_cnt = Column(Integer, default=0)
|
|
|
|
# 商业信息
|
|
industry_id = Column(String, nullable=True)
|
|
industry_name = Column(String, nullable=True)
|
|
brand_id = Column(String, nullable=True)
|
|
estimated_video_cost = Column(Float, default=0)
|
|
|
|
# 索引定义
|
|
__table_args__ = (
|
|
Index("idx_star_id", "star_id"),
|
|
Index("idx_star_unique_id", "star_unique_id"),
|
|
Index("idx_star_nickname", "star_nickname"),
|
|
)
|
|
|
|
def __repr__(self):
|
|
return f"<KolVideo(item_id={self.item_id}, title={self.title})>"
|