Initial commit of akmon project

This commit is contained in:
2026-01-20 08:04:15 +08:00
commit 77a2bab985
1309 changed files with 343305 additions and 0 deletions

View File

@@ -0,0 +1,662 @@
-- ===================================================================
-- 专题和评论系统演示数据 (PostgreSQL兼容版本)
-- 基于PostgreSQL 15+
-- 用于测试和演示专题和评论功能
-- ===================================================================
-- ===================================================================
-- 1. 专题演示数据
-- ===================================================================
-- 插入演示专题
INSERT INTO ak_topics (
id,
title,
description,
topic_type,
status,
cover_image_url,
creator_id,
content_count,
view_count,
like_count,
share_count,
comment_count,
meta_keywords,
meta_description,
seo_slug,
priority_level,
tags
) VALUES
(
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'AI技术发展全景从ChatGPT到未来',
'深度解析人工智能技术的发展历程、现状和未来趋势涵盖大语言模型、机器学习、深度学习等核心技术。本专题将带您全面了解AI技术的发展轨迹探索人工智能对社会各个领域的深远影响。',
'series',
'featured',
'https://example.com/images/ai-tech-cover.jpg',
'550e8400-e29b-41d4-a716-446655440000',
15,
28500,
256,
89,
42,
'{"人工智能", "ChatGPT", "AI技术", "机器学习", "深度学习", "大语言模型"}',
'AI技术发展专题从基础概念到前沿应用全面解析人工智能的发展历程和未来趋势',
'ai-technology-development-guide',
10,
'{"AI", "技术", "专题", "教程"}'
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d480',
'2025年全球经济展望',
'分析2025年全球经济形势包括主要经济体发展趋势、通胀压力、货币政策、贸易关系等重要议题。专题聚焦经济复苏、产业转型、金融市场波动等热点话题。',
'analysis',
'active',
'https://example.com/images/economy-2025-cover.jpg',
'550e8400-e29b-41d4-a716-446655440001',
8,
15600,
128,
45,
23,
'{"全球经济", "经济展望", "2025", "通胀", "货币政策", "经济复苏"}',
'2025年全球经济形势分析通胀、复苏、政策调整全解读',
'global-economy-outlook-2025',
8,
'{"经济", "分析", "2025", "全球"}'
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d481',
'气候变化应对策略追踪',
'追踪全球气候变化应对策略的最新进展,包括各国减排政策、清洁能源发展、碳中和目标实施情况等。持续更新国际气候合作动态和创新技术突破。',
'timeline',
'active',
'https://example.com/images/climate-action-cover.jpg',
'550e8400-e29b-41d4-a716-446655440002',
12,
19200,
186,
67,
31,
'{"气候变化", "碳中和", "清洁能源", "减排政策", "环保"}',
'气候变化应对策略实时追踪:政策进展、技术突破、国际合作',
'climate-action-tracking',
7,
'{"气候", "环保", "政策", "追踪"}'
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d482',
'突发:全球芯片短缺危机',
'追踪全球芯片短缺危机的最新发展,分析供应链中断、产业影响、各国应对措施等。实时更新半导体行业动态和市场变化。',
'breaking',
'featured',
'https://example.com/images/chip-shortage-cover.jpg',
'550e8400-e29b-41d4-a716-446655440003',
6,
32100,
298,
156,
89,
'{"芯片短缺", "半导体", "供应链", "科技产业", "突发事件"}',
'全球芯片短缺危机最新进展:供应链中断、产业冲击、应对策略',
'global-chip-shortage-crisis',
15,
'{"芯片", "突发", "科技", "供应链"}'
);
-- 插入专题内容关联(假设已有一些内容)
-- 注意这些内容ID需要在实际数据库中存在
INSERT INTO ak_topic_contents (
topic_id,
content_id,
display_order,
editor_note,
is_featured,
added_by
) VALUES
(
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'123e4567-e89b-12d3-a456-426614174000',
1,
'AI技术发展历史回顾适合作为专题开篇',
true,
'550e8400-e29b-41d4-a716-446655440000'
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'123e4567-e89b-12d3-a456-426614174001',
2,
'ChatGPT技术原理深度解析',
true,
'550e8400-e29b-41d4-a716-446655440000'
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'123e4567-e89b-12d3-a456-426614174002',
3,
'机器学习算法基础教程',
false,
'550e8400-e29b-41d4-a716-446655440000'
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d480',
'123e4567-e89b-12d3-a456-426614174003',
1,
'2025年经济预测报告',
true,
'550e8400-e29b-41d4-a716-446655440001'
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d481',
'123e4567-e89b-12d3-a456-426614174004',
1,
'全球气候行动最新动态',
true,
'550e8400-e29b-41d4-a716-446655440002'
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d482',
'123e4567-e89b-12d3-a456-426614174005',
1,
'芯片短缺影响分析',
true,
'550e8400-e29b-41d4-a716-446655440003'
);
-- 插入专题订阅数据
INSERT INTO ak_topic_subscriptions (
topic_id,
user_id,
notification_enabled
) VALUES
(
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'550e8400-e29b-41d4-a716-446655440010',
true
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'550e8400-e29b-41d4-a716-446655440011',
true
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d480',
'550e8400-e29b-41d4-a716-446655440012',
false
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d481',
'550e8400-e29b-41d4-a716-446655440013',
true
),
(
'f47ac10b-58cc-4372-a567-0e02b2c3d482',
'550e8400-e29b-41d4-a716-446655440014',
true
);
-- ===================================================================
-- 2. 评论演示数据
-- ===================================================================
-- 插入内容评论数据
INSERT INTO ak_comments (
id,
target_type,
target_id,
parent_id,
author_id,
author_name,
author_avatar,
content,
status,
like_count,
reply_count,
quality_score,
sentiment_score,
language_detected,
ip_address,
user_agent,
level,
thread_path
) VALUES
-- 顶级评论1
(
'11111111-1111-1111-1111-111111111111',
'content',
'123e4567-e89b-12d3-a456-426614174000',
NULL,
'550e8400-e29b-41d4-a716-446655440010',
'科技爱好者小王',
'https://example.com/avatar1.jpg',
'这篇关于AI技术发展的文章写得太好了从历史发展到现状分析再到未来展望脉络清晰内容丰富。特别是对ChatGPT等大语言模型的介绍很详细让我这个非技术人员也能理解。希望能看到更多关于AI伦理和社会影响的内容。',
'active',
15,
2,
0.85,
0.7,
'zh-CN',
'192.168.1.100',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
0,
'0001'
),
-- 对评论1的回复
(
'22222222-2222-2222-2222-222222222222',
'content',
'123e4567-e89b-12d3-a456-426614174000',
'11111111-1111-1111-1111-111111111111',
'550e8400-e29b-41d4-a716-446655440011',
'AI研究员张博士',
'https://example.com/avatar2.jpg',
'@科技爱好者小王 很高兴这篇文章对您有帮助关于AI伦理的话题确实很重要我们正在准备相关的专题内容敬请期待。如果您有具体想了解的方面欢迎留言告诉我们。',
'active',
8,
1,
0.92,
0.8,
'zh-CN',
'10.0.0.15',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
1,
'0001.0001'
),
-- 对回复的再回复
(
'33333333-3333-3333-3333-333333333333',
'content',
'123e4567-e89b-12d3-a456-426614174000',
'22222222-2222-2222-2222-222222222222',
'550e8400-e29b-41d4-a716-446655440010',
'科技爱好者小王',
'https://example.com/avatar1.jpg',
'@AI研究员张博士 太好了我特别关心AI在教育领域的应用和可能带来的教育公平问题期待您的专题内容',
'active',
3,
0,
0.78,
0.6,
'zh-CN',
'192.168.1.100',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
2,
'0001.0001.0001'
),
-- 另一个顶级评论
(
'44444444-4444-4444-4444-444444444444',
'content',
'123e4567-e89b-12d3-a456-426614174000',
NULL,
'550e8400-e29b-41d4-a716-446655440012',
'程序员小李',
'https://example.com/avatar3.jpg',
'作为一名AI工程师我觉得这篇文章的技术细节还可以更深入一些。比如Transformer架构的attention机制部分如果能配上更多的代码示例就更好了。不过总体来说还是很不错的科普文章。',
'active',
22,
1,
0.88,
0.4,
'zh-CN',
'203.0.113.42',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36',
0,
'0002'
),
-- 对评论4的回复
(
'55555555-5555-5555-5555-555555555555',
'content',
'123e4567-e89b-12d3-a456-426614174000',
'44444444-4444-4444-4444-444444444444',
'550e8400-e29b-41d4-a716-446655440013',
'内容编辑小陈',
'https://example.com/avatar4.jpg',
'@程序员小李 感谢您的专业建议我们正在考虑推出一个技术进阶系列会包含更多代码示例和实战案例。您提到的Transformer架构确实值得单独开一个深度教程。',
'active',
6,
0,
0.81,
0.5,
'zh-CN',
'172.16.0.8',
'Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15',
1,
'0002.0001'
);
-- 插入专题评论数据
INSERT INTO ak_comments (
id,
target_type,
target_id,
parent_id,
author_id,
author_name,
author_avatar,
content,
status,
like_count,
reply_count,
quality_score,
sentiment_score,
language_detected,
ip_address,
user_agent,
level,
thread_path
) VALUES
-- 专题评论1
(
'66666666-6666-6666-6666-666666666666',
'topic',
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
NULL,
'550e8400-e29b-41d4-a716-446655440014',
'AI学习者小刘',
'https://example.com/avatar5.jpg',
'这个AI技术专题真的太棒了从基础概念到前沿应用内容覆盖得很全面。作为一个刚入门AI的新手这个专题帮我建立了完整的知识框架。希望能继续更新更多实践案例。',
'active',
28,
1,
0.91,
0.9,
'zh-CN',
'198.51.100.23',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
0,
'0001'
),
-- 对专题评论的回复
(
'77777777-7777-7777-7777-777777777777',
'topic',
'f47ac10b-58cc-4372-a567-0e02b2c3d479',
'66666666-6666-6666-6666-666666666666',
'550e8400-e29b-41d4-a716-446655440000',
'专题编辑',
'https://example.com/avatar6.jpg',
'@AI学习者小刘 非常感谢您的反馈我们会继续丰富这个专题的内容下周计划发布几个AI实际应用的案例研究。也欢迎您在学习过程中提出问题和建议',
'active',
12,
0,
0.87,
0.8,
'zh-CN',
'10.0.0.20',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
1,
'0001.0001'
),
-- 另一个专题评论
(
'88888888-8888-8888-8888-888888888888',
'topic',
'f47ac10b-58cc-4372-a567-0e02b2c3d480',
NULL,
'550e8400-e29b-41d4-a716-446655440015',
'经济分析师老王',
'https://example.com/avatar7.jpg',
'2025年经济展望专题的分析很到位特别是对通胀压力和货币政策的解读。不过我觉得对新兴市场的分析还可以更深入一些比如印度、东南亚等地区的经济发展潜力。',
'active',
16,
0,
0.89,
0.3,
'zh-CN',
'203.0.113.67',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
0,
'0001'
),
-- 气候变化专题评论
(
'99999999-9999-9999-9999-999999999999',
'topic',
'f47ac10b-58cc-4372-a567-0e02b2c3d481',
NULL,
'550e8400-e29b-41d4-a716-446655440016',
'环保志愿者小张',
'https://example.com/avatar8.jpg',
'气候变化专题的实时追踪功能很实用,能及时了解各国的减排进展。建议增加一些普通人可以参与的环保行动指南,让更多人能够参与到气候行动中来。',
'active',
21,
0,
0.86,
0.8,
'zh-CN',
'198.51.100.89',
'Mozilla/5.0 (Android 12; Mobile; rv:94.0) Gecko/94.0 Firefox/94.0',
0,
'0001'
);
-- ===================================================================
-- 3. 评论反应数据
-- ===================================================================
-- 插入评论点赞/踩数据
INSERT INTO ak_comment_reactions (
comment_id,
user_id,
reaction_type
) VALUES
('11111111-1111-1111-1111-111111111111', '550e8400-e29b-41d4-a716-446655440020', 'like'),
('11111111-1111-1111-1111-111111111111', '550e8400-e29b-41d4-a716-446655440021', 'like'),
('11111111-1111-1111-1111-111111111111', '550e8400-e29b-41d4-a716-446655440022', 'like'),
('22222222-2222-2222-2222-222222222222', '550e8400-e29b-41d4-a716-446655440023', 'like'),
('22222222-2222-2222-2222-222222222222', '550e8400-e29b-41d4-a716-446655440024', 'like'),
('44444444-4444-4444-4444-444444444444', '550e8400-e29b-41d4-a716-446655440025', 'like'),
('44444444-4444-4444-4444-444444444444', '550e8400-e29b-41d4-a716-446655440026', 'dislike'),
('66666666-6666-6666-6666-666666666666', '550e8400-e29b-41d4-a716-446655440027', 'like'),
('66666666-6666-6666-6666-666666666666', '550e8400-e29b-41d4-a716-446655440028', 'like'),
('77777777-7777-7777-7777-777777777777', '550e8400-e29b-41d4-a716-446655440029', 'like');
-- ===================================================================
-- 4. 评论举报数据
-- ===================================================================
-- 插入评论举报数据
INSERT INTO ak_comment_reports (
comment_id,
reporter_id,
report_type,
reason,
description,
status
) VALUES
(
'44444444-4444-4444-4444-444444444444',
'550e8400-e29b-41d4-a716-446655440030',
'inappropriate',
'off_topic',
'这条评论偏离了文章主题,过于技术性,不适合一般读者阅读',
'pending'
),
(
'88888888-8888-8888-8888-888888888888',
'550e8400-e29b-41d4-a716-446655440031',
'spam',
'promotional',
'疑似推广内容,与专题讨论无关',
'reviewed'
);
-- ===================================================================
-- 5. 审核队列数据
-- ===================================================================
-- 插入审核队列数据
INSERT INTO ak_comment_moderation_queue (
comment_id,
priority,
moderator_id,
status,
review_notes,
auto_flagged_reasons
) VALUES
(
'44444444-4444-4444-4444-444444444444',
'high',
'550e8400-e29b-41d4-a716-446655440100',
'reviewed',
'评论内容专业性较强,但与主题相关,无需删除。建议鼓励作者提供更多科普性内容。',
'{"sentiment_negative": 0.6, "complexity_high": 0.8}'
),
(
'88888888-8888-8888-8888-888888888888',
'medium',
NULL,
'pending',
NULL,
'{"report_count": 1, "keywords_flagged": ["分析", "建议"]}'
);
-- ===================================================================
-- 6. 更新统计数据
-- ===================================================================
-- 更新内容的评论统计
UPDATE ak_contents
SET comment_count = (
SELECT COUNT(*)
FROM ak_comments
WHERE target_type = 'content' AND target_id = ak_contents.id AND status = 'active'
)
WHERE id IN (
SELECT DISTINCT target_id
FROM ak_comments
WHERE target_type = 'content'
);
-- 更新专题的评论统计
UPDATE ak_topics
SET comment_count = (
SELECT COUNT(*)
FROM ak_comments
WHERE target_type = 'topic' AND target_id = ak_topics.id AND status = 'active'
)
WHERE id IN (
SELECT DISTINCT target_id
FROM ak_comments
WHERE target_type = 'topic'
);
-- 更新专题的订阅统计
UPDATE ak_topics
SET subscriber_count = (
SELECT COUNT(*)
FROM ak_topic_subscriptions
WHERE topic_id = ak_topics.id
);
-- ===================================================================
-- 7. 数据验证查询
-- ===================================================================
-- 查询专题统计
SELECT
t.title,
t.topic_type,
t.status,
t.content_count,
t.view_count,
t.comment_count,
t.subscriber_count,
t.priority_level
FROM ak_topics t
ORDER BY t.priority_level DESC, t.created_at DESC;
-- 查询评论层级结构示例
SELECT
c.id,
c.level,
c.thread_path,
c.author_name,
SUBSTRING(c.content, 1, 50) + '...' as content_preview,
c.like_count,
c.reply_count,
c.created_at
FROM ak_comments c
WHERE c.target_type = 'content'
AND c.target_id = '123e4567-e89b-12d3-a456-426614174000'
ORDER BY c.thread_path;
-- 查询专题评论
SELECT
c.id,
t.title as topic_title,
c.author_name,
SUBSTRING(c.content, 1, 50) + '...' as content_preview,
c.like_count,
c.created_at
FROM ak_comments c
JOIN ak_topics t ON c.target_id = t.id
WHERE c.target_type = 'topic'
ORDER BY c.created_at DESC;
-- 查询评论反应统计
SELECT
c.id,
c.author_name,
SUBSTRING(c.content, 1, 30) + '...' as content_preview,
COUNT(CASE WHEN cr.reaction_type = 'like' THEN 1 END) as likes,
COUNT(CASE WHEN cr.reaction_type = 'dislike' THEN 1 END) as dislikes
FROM ak_comments c
LEFT JOIN ak_comment_reactions cr ON c.id = cr.comment_id
GROUP BY c.id, c.author_name, c.content
HAVING COUNT(cr.reaction_type) > 0
ORDER BY likes DESC;
-- 查询举报统计
SELECT
c.id,
c.author_name,
SUBSTRING(c.content, 1, 30) + '...' as content_preview,
COUNT(crp.id) as report_count,
STRING_AGG(crp.report_type, ', ') as report_types
FROM ak_comments c
LEFT JOIN ak_comment_reports crp ON c.id = crp.comment_id
GROUP BY c.id, c.author_name, c.content
HAVING COUNT(crp.id) > 0
ORDER BY report_count DESC;
-- ===================================================================
-- 演示数据说明
-- ===================================================================
/*
本演示数据包含以下内容:
1. 专题数据:
- 4个不同类型的专题系列、分析、时间轴、突发
- 包含完整的元数据、SEO信息、统计数据
- 涵盖AI技术、经济、气候、科技等热门话题
2. 评论数据:
- 多层级评论结构最多3层
- 内容评论和专题评论
- 包含作者信息、质量评分、情感分析等
3. 互动数据:
- 点赞、踩等反应
- 评论举报和审核
- 专题订阅
4. 统计数据:
- 自动更新各项统计计数
- 提供查询示例展示数据结构
使用方法:
1. 确保已执行主数据库结构文件
2. 执行本文件插入演示数据
3. 使用提供的查询示例验证数据
4. 根据实际需求调整数据内容
注意事项:
- 所有UUID和用户ID需要与实际系统匹配
- 内容ID需要在ak_contents表中存在
- 可根据实际需求调整数据量和内容
*/