feat(分享): 新增故事分享反馈功能
All checks were successful
test/timeline-server/pipeline/head This commit looks good

实现故事分享的评论和浏览统计功能,包括:
1. 新增StoryShareFeedbackService接口及相关实现
2. 添加StoryShareComment、StoryShareMetric实体类
3. 创建story_share_comment和story_share_metric表
4. 在StoryDetailVo中增加shareConfigured和sharePublished字段
5. 扩展StoryShareConfigVo包含反馈统计数据
6. 新增公共API端点处理反馈请求
7. 实现模板样式选择功能
This commit is contained in:
2026-03-18 14:05:42 +08:00
parent 427f66bce5
commit 7e3e1f66f1
26 changed files with 562 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ CREATE TABLE IF NOT EXISTS `story_share` (
`share_title` varchar(255) DEFAULT NULL COMMENT 'Curated public title',
`share_description` text COMMENT 'Curated public description',
`share_quote` text COMMENT 'Curated story note',
`template_style` varchar(32) DEFAULT 'editorial' COMMENT 'Public template style',
`featured_moment_ids` text COMMENT 'Comma separated featured moment IDs',
`create_id` varchar(32) DEFAULT NULL,
`update_id` varchar(32) DEFAULT NULL,

View File

@@ -0,0 +1,24 @@
CREATE TABLE IF NOT EXISTS `story_share_metric` (
`id` bigint NOT NULL AUTO_INCREMENT,
`share_id` varchar(64) NOT NULL,
`view_count` bigint NOT NULL DEFAULT '0',
`comment_count` bigint NOT NULL DEFAULT '0',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_story_share_metric_share_id` (`share_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE IF NOT EXISTS `story_share_comment` (
`id` bigint NOT NULL AUTO_INCREMENT,
`instance_id` varchar(64) NOT NULL,
`share_id` varchar(64) NOT NULL,
`visitor_name` varchar(40) NOT NULL,
`content` varchar(280) NOT NULL,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`is_delete` tinyint(1) DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_story_share_comment_instance_id` (`instance_id`),
KEY `idx_story_share_comment_share_id` (`share_id`, `is_delete`, `create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

View File

@@ -0,0 +1,24 @@
SET @story_share_table_exists = (
SELECT COUNT(*)
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'story_share'
);
SET @story_share_template_exists = (
SELECT COUNT(*)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'story_share'
AND COLUMN_NAME = 'template_style'
);
SET @story_share_template_stmt = IF(
@story_share_table_exists = 1 AND @story_share_template_exists = 0,
"ALTER TABLE story_share ADD COLUMN template_style varchar(32) DEFAULT 'editorial' COMMENT 'Public template style' AFTER share_quote",
'SELECT 1'
);
PREPARE story_share_template_stmt FROM @story_share_template_stmt;
EXECUTE story_share_template_stmt;
DEALLOCATE PREPARE story_share_template_stmt;