Просмотр исходного кода

chore: auto bump version and changelog [skip ci]

iwt 1 месяц назад
Родитель
Сommit
e9a414d75e

+ 46 - 1
cfc-backend/src/main/java/com/etotem/cfc/service/EnergyService.java

@@ -335,11 +335,56 @@ public class EnergyService {
         if (healthScore != null) {
             return healthScore;
         }
-        // 2. 降级:运动/户外类任务完成率
+        // 2. 7维健康维度评分加权(T4: 7-Dim→Body Energy)
+        int sevenDimScore = calcSevenDimBodyScore(child.getId());
+        if (sevenDimScore > 0) {
+            return sevenDimScore;
+        }
+        // 3. 降级:运动/户外类任务完成率
         return calcTaskCompletionRate(child.getId(), "child",
                 Arrays.asList("运动", "体育", "户外", "健康"), 365);
     }
 
+    /**
+     * 7维健康维度评分加权 → body 能量 (T4/T12)
+     * 从 health_dimension_scores 表读取成员最新的所有维度评分,
+     * 按设计权重加权计算 0-100 分的综合 body 能量。
+     * 各维度权重参考 specs/2026-06-26-health-dimensions-design-spec.md:
+     *  肠胃(20%) 营养(18%) 运动(15%) 睡眠(15%) 生长(12%) 免疫(10%) 视力(10%)
+     */
+    private int calcSevenDimBodyScore(Long memberId) {
+        try {
+            List<HealthDimensionScore> scores = healthDimensionScoreService.getLatestScores(memberId);
+            if (scores == null || scores.isEmpty()) {
+                return 0;
+            }
+            double weightedSum = 0;
+            double totalWeight = 0;
+            java.util.Map<String, Double> weights = new java.util.HashMap<>();
+            weights.put("gut", 0.20);
+            weights.put("nutrition", 0.18);
+            weights.put("exercise", 0.15);
+            weights.put("sleep", 0.15);
+            weights.put("growth", 0.12);
+            weights.put("immunity", 0.10);
+            weights.put("vision", 0.10);
+            for (HealthDimensionScore s : scores) {
+                Double w = weights.get(s.getDimension());
+                if (w != null && s.getScore() != null) {
+                    weightedSum += s.getScore() * w;
+                    totalWeight += w;
+                }
+            }
+            if (totalWeight == 0) {
+                return 0;
+            }
+            return (int) Math.round(weightedSum / totalWeight);
+        } catch (Exception e) {
+            log.warn("7维健康维度评分加权失败, memberId={}: {}", memberId, e.getMessage());
+            return 0;
+        }
+    }
+
     /** 孩子 心 — DAN EMI 70% + 先天 30% + 行为修正 */
     private int calcChildMind(FamilyMember child) {
         Long childId = child.getId();

+ 1 - 1
cfc-web/.last_build_commit

@@ -1 +1 @@
-3615eefb0a6ddf625a45ee4d8f34c33f95594db2
+83b2b2f8bd1cc286280ac62a95636de8cb3ddda2

+ 1 - 1
cfc-web/package.json

@@ -1,6 +1,6 @@
 {
   "name": "cfc-web",
-  "version": "1.0.526",
+  "version": "1.0.527",
   "private": true,
   "scripts": {
     "dev": "vue-cli-service serve",

+ 14 - 0
cfc-web/public/CHANGELOG-v1.0.md

@@ -4,6 +4,20 @@
 
 ---
 
+## v1.0.527 (2026-07-24)
+
+### 新功能
+- add ArticleBookshelf book-style recommendation component
+
+### 其他
+-   dimension-based color gradients, magazine spread overlay on tap
+- - Integrated into article-center/index.vue via getFeaturedArticles API
+- - Follows uni.scss design tokens, Vue 2 compatible (no optional chaining,
+-   flexbox layout)
+- - goExplore() navigation stub to /pages/article-center/article-explore
+- 
+
+
 ## v1.0.526 (2026-07-24)
 
 ### Bug 修复

+ 15 - 1
cfc-web/public/CHANGELOG.md

@@ -1,6 +1,6 @@
 # 更新日志
 
-> 当前版本: v1.0.526
+> 当前版本: v1.0.527
 
 ## 历史版本
 
@@ -8,6 +8,20 @@
 
 ---
 
+## v1.0.527 (2026-07-24)
+
+### 新功能
+- add ArticleBookshelf book-style recommendation component
+
+### 其他
+-   dimension-based color gradients, magazine spread overlay on tap
+- - Integrated into article-center/index.vue via getFeaturedArticles API
+- - Follows uni.scss design tokens, Vue 2 compatible (no optional chaining,
+-   flexbox layout)
+- - goExplore() navigation stub to /pages/article-center/article-explore
+- 
+
+
 ## v1.0.526 (2026-07-24)
 
 ### Bug 修复