|
|
@@ -1061,6 +1061,53 @@ log.info("已添加template_id列到tasks表");
|
|
|
log.warn("Product 种子数据初始化失败: {}", e.getMessage());
|
|
|
}
|
|
|
|
|
|
+ // 活动种子数据(3 个示例活动,覆盖身/心/智三个维度)
|
|
|
+ try {
|
|
|
+ insertActivitySeed("亲子户外徒步探险", "周末亲子徒步活动,在自然中锻炼体魄、增进亲子关系,全程约5公里。",
|
|
|
+ "body", "offline", "published",
|
|
|
+ "2026-08-15 09:00:00", "2026-08-15 16:00:00", "北京奥林匹克森林公园", 50, 0, 0);
|
|
|
+ insertActivitySeed("家庭正念静心工作坊", "专业导师带领的正念冥想体验,学习情绪调节和家庭沟通技巧。",
|
|
|
+ "mind", "offline", "published",
|
|
|
+ "2026-08-22 14:00:00", "2026-08-22 17:00:00", "北京市朝阳区心理成长中心", 30, 9900, 7900);
|
|
|
+ insertActivitySeed("少儿科学思维探索营", "通过动手实验激发孩子对科学的兴趣,培养逻辑思维与创造力。",
|
|
|
+ "wisdom", "online", "published",
|
|
|
+ "2026-09-05 10:00:00", "2026-09-05 12:00:00", "线上直播", 200, 19900, 15900);
|
|
|
+ log.info("Activity 种子数据已加载");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("Activity 种子数据初始化失败: {}", e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 文章种子数据(3 个示例文章,覆盖学习力/情绪管理/亲子教育分类)
|
|
|
+ try {
|
|
|
+ insertArticleSeed("如何培养孩子的自主学习力",
|
|
|
+ "从内在动机出发,帮助孩子建立自主学习习惯的实用方法指南。",
|
|
|
+ "article", 4L, "wisdom", "published", "曹老师",
|
|
|
+ "normal", 5, 1800,
|
|
|
+ "{\"body\":0,\"mind\":0,\"wisdom\":60,\"action\":40,\"wealth\":0}");
|
|
|
+ insertArticleSeed("儿童情绪管理的五个关键步骤",
|
|
|
+ "当孩子情绪爆发时,家长应该如何应对?本文提供一套可操作的情绪管理框架。",
|
|
|
+ "article", 2L, "mind", "published", "李老师",
|
|
|
+ "premium", 4, 2200,
|
|
|
+ "{\"body\":0,\"mind\":80,\"wisdom\":10,\"action\":10,\"wealth\":0}");
|
|
|
+ insertArticleSeed("亲子运动的正确打开方式",
|
|
|
+ "不同年龄段孩子的运动建议,让全家人在快乐中收获健康。",
|
|
|
+ "article", 3L, "action", "published", "王老师",
|
|
|
+ "normal", 3, 1500,
|
|
|
+ "{\"body\":40,\"mind\":0,\"wisdom\":0,\"action\":60,\"wealth\":0}");
|
|
|
+ log.info("Article 种子数据已加载");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("Article 种子数据初始化失败: {}", e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 补充商品种子数据(2 个,丰富商品库)
|
|
|
+ try {
|
|
|
+ insertProductSeed("少儿专注力训练教具盒", "含舒尔特方格、记忆卡片等8种专注力训练工具,适合5-12岁儿童。", "physical", 16800, "wisdom", "all");
|
|
|
+ insertProductSeed("家庭年度VIP成长会员", "一年内畅享全部线上课程、活动折扣及规划师咨询服务。", "digital", 298000, "action", "all");
|
|
|
+ log.info("补充 Product 种子数据已加载");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("补充 Product 种子数据初始化失败: {}", e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
// ==================== Phase 2: 内容区块可见性配置 ====================
|
|
|
|
|
|
// 内容区块配置表
|
|
|
@@ -4680,6 +4727,42 @@ try {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void insertActivitySeed(String title, String desc, String dimensionCode,
|
|
|
+ String activityType, String status,
|
|
|
+ String startTime, String endTime, String location,
|
|
|
+ int maxParticipants, int price, int memberPrice) {
|
|
|
+ Integer count = jdbcTemplate.queryForObject(
|
|
|
+ "SELECT COUNT(*) FROM activities WHERE title = ?", Integer.class, title);
|
|
|
+ if (count == null || count == 0) {
|
|
|
+ jdbcTemplate.update(
|
|
|
+ "INSERT INTO activities (title, description, dimension_code, activity_type, status, " +
|
|
|
+ "start_time, end_time, location, max_participants, current_participants, price, member_price, " +
|
|
|
+ "require_registration, checkin_points, created_at, updated_at) " +
|
|
|
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, 1, 10, NOW(), NOW())",
|
|
|
+ title, desc, dimensionCode, activityType, status,
|
|
|
+ startTime, endTime, location, maxParticipants, price, memberPrice);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void insertArticleSeed(String title, String summary, String contentType,
|
|
|
+ Long categoryId, String dimensionCode, String status,
|
|
|
+ String author, String articleType, int readTime, int wordCount,
|
|
|
+ String dimensionWeights) {
|
|
|
+ Integer count = jdbcTemplate.queryForObject(
|
|
|
+ "SELECT COUNT(*) FROM articles WHERE title = ?", Integer.class, title);
|
|
|
+ if (count == null || count == 0) {
|
|
|
+ jdbcTemplate.update(
|
|
|
+ "INSERT INTO articles (title, summary, content, content_type, category_id, " +
|
|
|
+ "related_dimensions, dimension_weights, status, author, article_type, " +
|
|
|
+ "read_time, word_count, is_featured, view_count, author_type, audit_status, " +
|
|
|
+ "visibility, created_at, updated_at) " +
|
|
|
+ "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, 0, 'admin', 'approved', 'public', NOW(), NOW())",
|
|
|
+ title, summary, "(此处为示例文章正文内容,实际数据应在运营后台编辑发布。)",
|
|
|
+ contentType, categoryId, "[\"" + dimensionCode + "\"]", dimensionWeights,
|
|
|
+ status, author, articleType, readTime, wordCount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void insertContentSectionSeed(String pageKey, String sectionKey, String title,
|
|
|
String allowedRoles, int sortOrder) {
|
|
|
Integer count = jdbcTemplate.queryForObject(
|