|
|
@@ -128,6 +128,7 @@ CREATE TABLE IF NOT EXISTS comments (
|
|
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
|
|
user_id INT NOT NULL,
|
|
|
account_id INT NOT NULL,
|
|
|
+ work_id INT NULL COMMENT '作品ID(关联works.id,可为空)',
|
|
|
platform VARCHAR(50),
|
|
|
video_id VARCHAR(100),
|
|
|
platform_video_url VARCHAR(500),
|
|
|
@@ -146,6 +147,7 @@ CREATE TABLE IF NOT EXISTS comments (
|
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
|
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
|
|
FOREIGN KEY (account_id) REFERENCES platform_accounts(id) ON DELETE CASCADE,
|
|
|
+ FOREIGN KEY (work_id) REFERENCES works(id) ON DELETE SET NULL,
|
|
|
INDEX idx_comment_user_read (user_id, is_read),
|
|
|
INDEX idx_comment_account (account_id)
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
@@ -204,6 +206,22 @@ CREATE TABLE IF NOT EXISTS works (
|
|
|
comment_count INT DEFAULT 0,
|
|
|
share_count INT DEFAULT 0,
|
|
|
collect_count INT DEFAULT 0,
|
|
|
+ -- ===== 昨日数据快照(yesterday_*)=====
|
|
|
+ yesterday_play_count INT DEFAULT 0 COMMENT '昨日播放数',
|
|
|
+ yesterday_like_count INT DEFAULT 0 COMMENT '昨日点赞数',
|
|
|
+ yesterday_comment_count INT DEFAULT 0 COMMENT '昨日评论数',
|
|
|
+ yesterday_share_count INT DEFAULT 0 COMMENT '昨日分享数',
|
|
|
+ yesterday_collect_count INT DEFAULT 0 COMMENT '昨日收藏数',
|
|
|
+ yesterday_recommend_count INT DEFAULT 0 COMMENT '昨日推荐数',
|
|
|
+ yesterday_fans_increase INT DEFAULT 0 COMMENT '昨日涨粉数',
|
|
|
+ yesterday_follow_count INT DEFAULT 0 COMMENT '昨日关注数',
|
|
|
+ yesterday_cover_click_rate VARCHAR(50) DEFAULT '0' COMMENT '昨日封面点击率',
|
|
|
+ yesterday_avg_watch_duration VARCHAR(50) DEFAULT '0' COMMENT '昨日平均观看时长',
|
|
|
+ yesterday_total_watch_duration VARCHAR(50) DEFAULT '0' COMMENT '昨日总观看时长',
|
|
|
+ yesterday_completion_rate VARCHAR(50) DEFAULT '0' COMMENT '昨日完播率',
|
|
|
+ yesterday_two_second_exit_rate VARCHAR(50) DEFAULT '0' COMMENT '昨日2秒退出率',
|
|
|
+ yesterday_completion_rate_5s VARCHAR(50) DEFAULT '0' COMMENT '昨日5秒完播率',
|
|
|
+ yesterday_exposure_count INT DEFAULT 0 COMMENT '昨日曝光数',
|
|
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
INDEX idx_user_platform (userId, platform),
|
|
|
@@ -219,10 +237,12 @@ CREATE TABLE IF NOT EXISTS work_day_statistics (
|
|
|
play_count INT DEFAULT 0 COMMENT '播放数',
|
|
|
exposure_count INT DEFAULT 0 COMMENT '曝光数/展现量',
|
|
|
like_count INT DEFAULT 0 COMMENT '点赞数',
|
|
|
+ recommend_count INT DEFAULT 0 COMMENT '推荐量',
|
|
|
comment_count INT DEFAULT 0 COMMENT '评论数',
|
|
|
share_count INT DEFAULT 0 COMMENT '分享数',
|
|
|
collect_count INT DEFAULT 0 COMMENT '收藏数',
|
|
|
fans_increase INT DEFAULT 0 COMMENT '涨粉数',
|
|
|
+ follow_count INT DEFAULT 0 COMMENT '关注数',
|
|
|
cover_click_rate VARCHAR(50) DEFAULT '0' COMMENT '封面点击率',
|
|
|
avg_watch_duration VARCHAR(50) DEFAULT '0' COMMENT '平均观看时长(秒)',
|
|
|
total_watch_duration VARCHAR(50) DEFAULT '0' COMMENT '总观看时长(秒)',
|
|
|
@@ -250,6 +270,8 @@ CREATE TABLE IF NOT EXISTS user_day_statistics (
|
|
|
like_count INT DEFAULT 0 COMMENT '点赞数',
|
|
|
share_count INT DEFAULT 0 COMMENT '分享数',
|
|
|
collect_count INT DEFAULT 0 COMMENT '收藏数',
|
|
|
+ recommend_count INT DEFAULT 0 COMMENT '推荐数',
|
|
|
+ follow_count INT DEFAULT 0 COMMENT '关注数(来自视频等)',
|
|
|
cover_click_rate VARCHAR(50) DEFAULT '0' COMMENT '封面点击率',
|
|
|
avg_watch_duration VARCHAR(50) DEFAULT '0' COMMENT '平均观看时长(秒)',
|
|
|
total_watch_duration VARCHAR(50) DEFAULT '0' COMMENT '观看总时长(秒)',
|