浏览代码

refactor: rename childId to memberId across full stack (childId was always family_member.id)

E2E Test Bot 1 月之前
父节点
当前提交
1bfa2c1812
共有 100 个文件被更改,包括 847 次插入729 次删除
  1. 23 0
      cfc-backend/src/main/java/com/etotem/cfc/config/JwtInterceptor.java
  2. 18 14
      cfc-backend/src/main/java/com/etotem/cfc/controller/ActivityController.java
  3. 8 6
      cfc-backend/src/main/java/com/etotem/cfc/controller/ActivityFeedbackController.java
  4. 16 12
      cfc-backend/src/main/java/com/etotem/cfc/controller/BadgeController.java
  5. 8 7
      cfc-backend/src/main/java/com/etotem/cfc/controller/CircleController.java
  6. 12 10
      cfc-backend/src/main/java/com/etotem/cfc/controller/DailyFeedbackController.java
  7. 13 10
      cfc-backend/src/main/java/com/etotem/cfc/controller/DanAssessmentController.java
  8. 8 7
      cfc-backend/src/main/java/com/etotem/cfc/controller/EmiReportController.java
  9. 28 24
      cfc-backend/src/main/java/com/etotem/cfc/controller/EnergyController.java
  10. 5 4
      cfc-backend/src/main/java/com/etotem/cfc/controller/FamilyChallengeController.java
  11. 8 8
      cfc-backend/src/main/java/com/etotem/cfc/controller/GameRecordController.java
  12. 5 4
      cfc-backend/src/main/java/com/etotem/cfc/controller/HealthAlertController.java
  13. 17 14
      cfc-backend/src/main/java/com/etotem/cfc/controller/HealthCheckinController.java
  14. 55 52
      cfc-backend/src/main/java/com/etotem/cfc/controller/HealthReportController.java
  15. 10 8
      cfc-backend/src/main/java/com/etotem/cfc/controller/HealthScoreController.java
  16. 5 4
      cfc-backend/src/main/java/com/etotem/cfc/controller/HealthTimelineController.java
  17. 5 3
      cfc-backend/src/main/java/com/etotem/cfc/controller/MealRecommendController.java
  18. 18 15
      cfc-backend/src/main/java/com/etotem/cfc/controller/MicroActionController.java
  19. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/controller/MiniGameController.java
  20. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/PackagePaymentController.java
  21. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/PointsExchangeController.java
  22. 8 8
      cfc-backend/src/main/java/com/etotem/cfc/controller/ReportStatsController.java
  23. 4 4
      cfc-backend/src/main/java/com/etotem/cfc/controller/ReportSurveyController.java
  24. 4 4
      cfc-backend/src/main/java/com/etotem/cfc/controller/StreakController.java
  25. 9 9
      cfc-backend/src/main/java/com/etotem/cfc/controller/admin/AdminController.java
  26. 9 8
      cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentAppointmentController.java
  27. 21 18
      cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentComparisonController.java
  28. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentQuotaController.java
  29. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentReportController.java
  30. 17 15
      cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentResultController.java
  31. 48 41
      cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/CognitiveController.java
  32. 8 6
      cfc-backend/src/main/java/com/etotem/cfc/controller/content/ArticleCommentController.java
  33. 26 21
      cfc-backend/src/main/java/com/etotem/cfc/controller/content/ArticleController.java
  34. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/family/FamilyUserController.java
  35. 33 28
      cfc-backend/src/main/java/com/etotem/cfc/controller/family/PointsController.java
  36. 6 6
      cfc-backend/src/main/java/com/etotem/cfc/controller/growth/GrowthPlanController.java
  37. 35 27
      cfc-backend/src/main/java/com/etotem/cfc/controller/growth/GrowthRecordController.java
  38. 7 7
      cfc-backend/src/main/java/com/etotem/cfc/controller/guide/GuideFamilyTaskController.java
  39. 23 20
      cfc-backend/src/main/java/com/etotem/cfc/controller/guide/TrainingPlanController.java
  40. 14 12
      cfc-backend/src/main/java/com/etotem/cfc/controller/mind/EmotionAlertController.java
  41. 20 15
      cfc-backend/src/main/java/com/etotem/cfc/controller/mind/EmotionCheckinController.java
  42. 13 9
      cfc-backend/src/main/java/com/etotem/cfc/controller/mind/MindController.java
  43. 8 6
      cfc-backend/src/main/java/com/etotem/cfc/controller/mind/ScreeningController.java
  44. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/parent/ParentAssessmentController.java
  45. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/product/ProductOrderController.java
  46. 15 12
      cfc-backend/src/main/java/com/etotem/cfc/controller/reward/RewardController.java
  47. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/stats/StatsController.java
  48. 23 19
      cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskController.java
  49. 21 21
      cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskReminderController.java
  50. 10 8
      cfc-backend/src/main/java/com/etotem/cfc/controller/wealth/FinanceCheckinController.java
  51. 12 12
      cfc-backend/src/main/java/com/etotem/cfc/controller/wisdom/WisdomMathController.java
  52. 4 4
      cfc-backend/src/main/java/com/etotem/cfc/controller/wish/WishController.java
  53. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/AdjustPointsDTO.java
  54. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/AdminAdjustPointsDTO.java
  55. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/ApplyAfterPaymentDTO.java
  56. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/ApplyPackageDTO.java
  57. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentAppointmentDTO.java
  58. 3 3
      cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentCreateAppointmentDTO.java
  59. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentCreateOrderDTO.java
  60. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentQuotaVO.java
  61. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentResultDTO.java
  62. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/dto/CognitiveRecommendationDTO.java
  63. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/CompleteGameDTO.java
  64. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/CompleteTaskDTO.java
  65. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/CreateAppointmentDTO.java
  66. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/CreateAssessmentResultDTO.java
  67. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/CreateCognitiveTaskDTO.java
  68. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/CreateGrowthRecordDTO.java
  69. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/CreateRewardDTO.java
  70. 13 13
      cfc-backend/src/main/java/com/etotem/cfc/dto/CreateTaskDTO.java
  71. 7 7
      cfc-backend/src/main/java/com/etotem/cfc/dto/CreateWishDTO.java
  72. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/DanAssessmentResultDTO.java
  73. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/EmiReportDTO.java
  74. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/EmotionAlertVO.java
  75. 5 5
      cfc-backend/src/main/java/com/etotem/cfc/dto/EmotionCheckinDTO.java
  76. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/dto/EmotionCheckinVO.java
  77. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/ExecutionDetailResponse.java
  78. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/GrowthPlanDTO.java
  79. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/dto/MinigameCompleteDTO.java
  80. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/dto/PackagePurchaseDTO.java
  81. 5 5
      cfc-backend/src/main/java/com/etotem/cfc/dto/RecommendRequestDTO.java
  82. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/dto/RewardDTO.java
  83. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/RewardExchangeDTO.java
  84. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/dto/RewardWishlistDTO.java
  85. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/ScreenResultVO.java
  86. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/ScreenSubmitDTO.java
  87. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/StudentProgressDTO.java
  88. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/SwitchToChildDTO.java
  89. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/SyncExternalResultDTO.java
  90. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/TaskDTO.java
  91. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/dto/UpdateChildDTO.java
  92. 6 6
      cfc-backend/src/main/java/com/etotem/cfc/dto/WishDTO.java
  93. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/service/AIService.java
  94. 5 5
      cfc-backend/src/main/java/com/etotem/cfc/service/ActivityFeedbackService.java
  95. 11 11
      cfc-backend/src/main/java/com/etotem/cfc/service/ActivityOrderService.java
  96. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/service/ActivityProvisionService.java
  97. 21 21
      cfc-backend/src/main/java/com/etotem/cfc/service/ActivityRegistrationService.java
  98. 20 20
      cfc-backend/src/main/java/com/etotem/cfc/service/ActivityService.java
  99. 6 6
      cfc-backend/src/main/java/com/etotem/cfc/service/AiContextService.java
  100. 24 24
      cfc-backend/src/main/java/com/etotem/cfc/service/ArticleService.java

+ 23 - 0
cfc-backend/src/main/java/com/etotem/cfc/config/JwtInterceptor.java

@@ -1,6 +1,8 @@
 package com.etotem.cfc.config;
 
+import com.etotem.cfc.entity.FamilyMember;
 import com.etotem.cfc.entity.User;
+import com.etotem.cfc.mapper.FamilyMemberMapper;
 import com.etotem.cfc.mapper.UserMapper;
 import io.jsonwebtoken.Claims;
 import lombok.extern.slf4j.Slf4j;
@@ -24,6 +26,9 @@ public class JwtInterceptor implements HandlerInterceptor {
     @Resource
     private UserMapper userMapper;
 
+    @Resource
+    private FamilyMemberMapper familyMemberMapper;
+
     private static final String[] PUBLIC_PATHS = {
         "/api/auth/send-code",
         "/api/auth/phone-login",
@@ -140,6 +145,24 @@ public class JwtInterceptor implements HandlerInterceptor {
                 log.warn("查询用户familyId失败: userId={}, error={}", userId, e.getMessage());
             }
 
+            // 设置currentMemberId:child角色自动从family_member表查找
+            if ("child".equals(role) && request.getAttribute("familyId") != null) {
+                try {
+                    Long familyId = (Long) request.getAttribute("familyId");
+                    FamilyMember member = familyMemberMapper.selectOne(
+                        new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<FamilyMember>()
+                            .eq(FamilyMember::getUserId, userId)
+                            .eq(FamilyMember::getFamilyId, familyId)
+                            .last("LIMIT 1")
+                    );
+                    if (member != null) {
+                        request.setAttribute("currentMemberId", member.getId());
+                    }
+                } catch (Exception e) {
+                    log.warn("查询child对应family_member失败: userId={}, error={}", userId, e.getMessage());
+                }
+            }
+
             return true;
         } catch (Exception e) {
             if (loginRequired) {

+ 18 - 14
cfc-backend/src/main/java/com/etotem/cfc/controller/ActivityController.java

@@ -109,7 +109,8 @@ public class ActivityController {
     }
 
     @PostMapping("/register")
-    public Result<Map<String, Object>> register(@RequestBody Map<String, Object> params, @RequestAttribute(value = "userId", required = false) Long userId) {
+    public Result<Map<String, Object>> register(@RequestBody Map<String, Object> params, @RequestAttribute(value = "userId", required = false) Long userId,
+                                                @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long activityId = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
         if (activityId == null) return Result.error("活动ID不能为空");
         // batch registration with registrants list
@@ -119,34 +120,37 @@ public class ActivityController {
             return registrationService.batchRegister(activityId, userId, registrants);
         }
         // single registration (backward compatibility)
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) return Result.error("孩子ID不能为空");
-        return registrationService.register(activityId, userId, childId);
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) return Result.error("孩子ID不能为空");
+        return registrationService.register(activityId, userId, memberId);
     }
 
     @PostMapping("/cancel-registration")
-    public Result<Void> cancelRegistration(@RequestBody Map<String, Object> params, @RequestAttribute(value = "userId", required = false) Long userId) {
+    public Result<Void> cancelRegistration(@RequestBody Map<String, Object> params, @RequestAttribute(value = "userId", required = false) Long userId,
+                                           @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long activityId = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         if (activityId == null) return Result.error("活动ID不能为空");
-        if (childId == null) return Result.error("孩子ID不能为空");
-        return registrationService.cancel(activityId, userId, childId);
+        if (memberId == null) return Result.error("孩子ID不能为空");
+        return registrationService.cancel(activityId, userId, memberId);
     }
 
     @PostMapping("/my-registrations")
-    public Result<Map<String, Object>> myRegistrations(@RequestBody Map<String, Object> params, @RequestAttribute(value = "userId", required = false) Long userId) {
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+    public Result<Map<String, Object>> myRegistrations(@RequestBody Map<String, Object> params, @RequestAttribute(value = "userId", required = false) Long userId,
+                                                       @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         Integer page = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
         Integer size = params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 10;
-        return registrationService.getMyRegistrations(userId, childId, page, size);
+        return registrationService.getMyRegistrations(userId, memberId, page, size);
     }
 
     @PostMapping("/checkin")
-    public Result<Map<String, Object>> checkin(@RequestBody Map<String, Object> params, @RequestAttribute(value = "userId", required = false) Long userId) {
+    public Result<Map<String, Object>> checkin(@RequestBody Map<String, Object> params, @RequestAttribute(value = "userId", required = false) Long userId,
+                                               @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long id = params.get("id") != null ? Long.valueOf(params.get("id").toString()) : null;
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         if (id == null) return Result.error("id不能为空");
-        Map<String, Object> checkinResult = activityService.checkin(id, userId, childId);
+        Map<String, Object> checkinResult = activityService.checkin(id, userId, memberId);
         if (checkinResult.containsKey("error")) return Result.error(checkinResult.get("error").toString());
         return Result.success(checkinResult);
     }

+ 8 - 6
cfc-backend/src/main/java/com/etotem/cfc/controller/ActivityFeedbackController.java

@@ -14,13 +14,14 @@ public class ActivityFeedbackController {
 
     @PostMapping("/submit")
     public Result<?> submit(@RequestBody Map<String, Object> params,
-                            @RequestAttribute("userId") Long userId) {
+                            @RequestAttribute("userId") Long userId,
+                            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long activityId = params.get("activityId") != null ? Long.valueOf(params.get("activityId").toString()) : null;
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String ratings = (String) params.get("ratings");
         String comment = (String) params.get("comment");
         if (activityId == null) return Result.error("活动ID不能为空");
-        return activityFeedbackService.submit(activityId, userId, childId, ratings, comment);
+        return activityFeedbackService.submit(activityId, userId, memberId, ratings, comment);
     }
 
     @PostMapping("/list")
@@ -32,10 +33,11 @@ public class ActivityFeedbackController {
 
     @PostMapping("/my")
     public Result<?> my(@RequestBody Map<String, Object> params,
-                        @RequestAttribute("userId") Long userId) {
+                        @RequestAttribute("userId") Long userId,
+                        @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long activityId = params.get("activityId") != null ? Long.valueOf(params.get("activityId").toString()) : null;
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         if (activityId == null) return Result.error("活动ID不能为空");
-        return activityFeedbackService.getMyFeedback(activityId, childId != null ? childId : null);
+        return activityFeedbackService.getMyFeedback(activityId, memberId != null ? memberId : null);
     }
 }

+ 16 - 12
cfc-backend/src/main/java/com/etotem/cfc/controller/BadgeController.java

@@ -71,10 +71,11 @@ public class BadgeController {
 
     @Operation(summary = "手动授予勋章")
     @PostMapping("/grant")
-    public Result<String> grantBadge(@RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
+    public Result<String> grantBadge(@RequestBody Map<String, Object> body,
+                                     @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         Long badgeId = Long.valueOf(body.get("badgeId").toString());
-        badgeService.grantBadge(childId, badgeId);
+        badgeService.grantBadge(memberId, badgeId);
         return Result.success("授予成功");
     }
 
@@ -82,9 +83,10 @@ public class BadgeController {
 
     @Operation(summary = "获取孩子的勋章列表")
     @PostMapping("/child/list")
-    public Result<List<Map<String, Object>>> getChildBadges(@RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
-        List<ChildBadge> childBadges = badgeService.getActiveChildBadges(childId);
+    public Result<List<Map<String, Object>>> getChildBadges(@RequestBody Map<String, Object> body,
+                                                            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
+        List<ChildBadge> childBadges = badgeService.getActiveChildBadges(memberId);
         List<Map<String, Object>> result = new java.util.ArrayList<>();
         for (ChildBadge cb : childBadges) {
             Badge badge = badgeService.getBadgeById(cb.getBadgeId());
@@ -100,10 +102,11 @@ public class BadgeController {
 
     @Operation(summary = "收藏/取消收藏勋章")
     @PostMapping("/favorite")
-    public Result<String> toggleFavorite(@RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
+    public Result<String> toggleFavorite(@RequestBody Map<String, Object> body,
+                                         @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         Long badgeId = Long.valueOf(body.get("badgeId").toString());
-        badgeService.toggleFavorite(childId, badgeId);
+        badgeService.toggleFavorite(memberId, badgeId);
         return Result.success("操作成功");
     }
 
@@ -111,9 +114,10 @@ public class BadgeController {
 
     @Operation(summary = "孩子勋章统计")
     @PostMapping("/statistics/child")
-    public Result<Map<String, Object>> getChildStats(@RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
-        return Result.success(badgeService.getChildBadgeStats(childId));
+    public Result<Map<String, Object>> getChildStats(@RequestBody Map<String, Object> body,
+                                                     @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
+        return Result.success(badgeService.getChildBadgeStats(memberId));
     }
 
     @Operation(summary = "家庭勋章排行")

+ 8 - 7
cfc-backend/src/main/java/com/etotem/cfc/controller/CircleController.java

@@ -41,14 +41,15 @@ public class CircleController {
      * 发现推荐圈子
      */
     @PostMapping("/discover")
-    public Result<List<Map<String, Object>>> discover(@RequestBody Map<String, Object> params) {
-        Object childIdObj = params.get("childId");
-        Long childId = childIdObj != null && !childIdObj.toString().trim().isEmpty()
-                ? Long.valueOf(childIdObj.toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+    public Result<List<Map<String, Object>>> discover(@RequestBody Map<String, Object> params,
+                                                      @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Object memberIdObj = params.get("memberId");
+        Long memberId = memberIdObj != null && !memberIdObj.toString().trim().isEmpty()
+                ? Long.valueOf(memberIdObj.toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        List<Map<String, Object>> circles = circleService.discoverCircles(childId);
+        List<Map<String, Object>> circles = circleService.discoverCircles(memberId);
         return Result.success(circles);
     }
 

+ 12 - 10
cfc-backend/src/main/java/com/etotem/cfc/controller/DailyFeedbackController.java

@@ -27,14 +27,15 @@ public class DailyFeedbackController {
     @PostMapping("/today")
     public Result<Map<String, Object>> today(
             @RequestBody Map<String, Object> params,
-            @RequestAttribute("userId") Long userId) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        DailyFeedback feedback = dailyFeedbackService.getTodayFeedback(childId);
+            @RequestAttribute("userId") Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        DailyFeedback feedback = dailyFeedbackService.getTodayFeedback(memberId);
 
         // Auto-generate if none exists
-        if (feedback == null && childId != null) {
-            feedback = dailyFeedbackService.generatePresetFeedback(userId, childId);
+        if (feedback == null && memberId != null) {
+            feedback = dailyFeedbackService.generatePresetFeedback(userId, memberId);
         }
 
         Map<String, Object> result = new HashMap<>();
@@ -57,11 +58,12 @@ public class DailyFeedbackController {
 
     @Operation(summary = "获取最近反馈列表")
     @PostMapping("/recent")
-    public Result<List<DailyFeedback>> recent(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
+    public Result<List<DailyFeedback>> recent(@RequestBody Map<String, Object> params,
+                                              @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         int limit = params.get("limit") != null
                 ? Integer.parseInt(params.get("limit").toString()) : 7;
-        return Result.success(dailyFeedbackService.getRecentFeedbacks(childId, limit));
+        return Result.success(dailyFeedbackService.getRecentFeedbacks(memberId, limit));
     }
 }

+ 13 - 10
cfc-backend/src/main/java/com/etotem/cfc/controller/DanAssessmentController.java

@@ -109,12 +109,13 @@ public class DanAssessmentController {
 
     @Operation(summary = "创建测评记录")
     @PostMapping("/record/create")
-    public Result<AssessmentRecord> createRecord(@RequestBody Map<String, Object> body) {
+    public Result<AssessmentRecord> createRecord(@RequestBody Map<String, Object> body,
+                                                 @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long familyId = Long.valueOf(body.get("familyId").toString());
-        Long childId = Long.valueOf(body.get("childId").toString());
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         Long materialId = body.get("materialId") != null
                 ? Long.valueOf(body.get("materialId").toString()) : null;
-        return Result.success(assessmentService.createRecord(familyId, childId, materialId));
+        return Result.success(assessmentService.createRecord(familyId, memberId, materialId));
     }
 
     @Operation(summary = "完成测评记录")
@@ -175,16 +176,17 @@ public class DanAssessmentController {
 
     @Operation(summary = "创建测评预约")
     @PostMapping("/appointment/create")
-    public Result<AssessmentAppointment> createAppointment(@RequestBody Map<String, Object> body) {
+    public Result<AssessmentAppointment> createAppointment(@RequestBody Map<String, Object> body,
+                                                           @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long userId = body.get("userId") != null ? Long.valueOf(body.get("userId").toString()) : null;
-        Long childId = Long.valueOf(body.get("childId").toString());
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         Long guideId = Long.valueOf(body.get("guideId").toString());
         Long packageId = body.get("packageId") != null ? Long.valueOf(body.get("packageId").toString()) : null;
         String appointmentDate = (String) body.get("appointmentDate");
         String appointmentTime = (String) body.get("appointmentTime");
         String notes = (String) body.get("notes");
         AssessmentAppointment appointment = appointmentService.createAppointment(
-                userId, childId, guideId, null, packageId, appointmentDate, appointmentTime, notes);
+                userId, memberId, guideId, null, packageId, appointmentDate, appointmentTime, notes);
         return Result.success(appointment);
     }
 
@@ -226,7 +228,7 @@ public class DanAssessmentController {
             item.put("id", app.getId());
             item.put("userId", app.getUserId());
             item.put("familyId", app.getFamilyId());
-            item.put("childId", app.getChildId());
+            item.put("memberId", app.getChildId());
             item.put("guideId", app.getGuideId());
             item.put("packageId", app.getPackageId());
             item.put("appointmentDate", app.getAppointmentDate());
@@ -260,10 +262,11 @@ public class DanAssessmentController {
 
     @Operation(summary = "创建测评订单(含预约)")
     @PostMapping("/order/create")
-    public Result<AssessmentOrder> createOrder(@RequestBody Map<String, Object> body) {
+    public Result<AssessmentOrder> createOrder(@RequestBody Map<String, Object> body,
+                                               @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long familyId = body.get("familyId") != null ? Long.valueOf(body.get("familyId").toString()) : null;
         Long userId = body.get("userId") != null ? Long.valueOf(body.get("userId").toString()) : null;
-        Long childId = Long.valueOf(body.get("childId").toString());
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         Long guideId = Long.valueOf(body.get("guideId").toString());
         Long packageId = body.get("packageId") != null ? Long.valueOf(body.get("packageId").toString()) : null;
         String guideName = (String) body.get("guideName");
@@ -272,7 +275,7 @@ public class DanAssessmentController {
         Long discountAmount = body.get("discountAmount") != null
                 ? Long.valueOf(body.get("discountAmount").toString()) : 0L;
 
-        AssessmentOrder order = orderService.createOrder(familyId, userId, childId,
+        AssessmentOrder order = orderService.createOrder(familyId, userId, memberId,
                 guideId, packageId, guideName, packageName, totalPrice, discountAmount);
         return Result.success(order);
     }

+ 8 - 7
cfc-backend/src/main/java/com/etotem/cfc/controller/EmiReportController.java

@@ -20,15 +20,16 @@ public class EmiReportController {
 
     @Operation(summary = "获取孩子最新EMI心理报告")
     @PostMapping("/latest")
-    public Result<EmiReportDTO> getLatestReport(@RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+    public Result<EmiReportDTO> getLatestReport(@RequestBody Map<String, Object> body,
+                                                @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
 
-        EmiReportDTO dto = emiReportService.getChildLatestEmiReport(childId);
+        EmiReportDTO dto = emiReportService.getChildLatestEmiReport(memberId);
         if (dto == null) {
             return Result.error("未找到EMI测评结果");
         }

+ 28 - 24
cfc-backend/src/main/java/com/etotem/cfc/controller/EnergyController.java

@@ -57,16 +57,17 @@ public class EnergyController {
     @Operation(summary = "获取五维能量概览")
     @PostMapping("/overview")
     public Result<Map<String, Object>> getEnergyOverview(
-            @RequestBody(required = false) Map<String, Object> params) {
+            @RequestBody(required = false) Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         if (params == null) {
             return Result.error("请求体不能为空");
         }
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        Map<String, Object> data = energyService.getOverview(childId);
+        Map<String, Object> data = energyService.getOverview(memberId);
         return Result.success(data);
     }
 
@@ -76,11 +77,12 @@ public class EnergyController {
     @Operation(summary = "查询能量流水")
     @PostMapping("/logs")
     public Result<Page<EnergyLog>> getEnergyLogs(
-            @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
         String dimensionCode = (String) params.get("dimensionCode");
         Integer page = params.get("page") != null
@@ -88,7 +90,7 @@ public class EnergyController {
         Integer size = params.get("size") != null
                 ? Integer.valueOf(params.get("size").toString()) : 10;
 
-        Page<EnergyLog> data = energyService.getLogs(childId, dimensionCode, page, size);
+        Page<EnergyLog> data = energyService.getLogs(memberId, dimensionCode, page, size);
         return Result.success(data);
     }
 
@@ -98,20 +100,21 @@ public class EnergyController {
     @Operation(summary = "发放能量")
     @PostMapping("/grant")
     public Result<EnergyLog> grantEnergy(
-            @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         Long taskId = params.get("taskId") != null
                 ? Long.valueOf(params.get("taskId").toString()) : null;
         Long amount = params.get("amount") != null
                 ? Long.valueOf(params.get("amount").toString()) : null;
         String dimensionCode = (String) params.get("dimensionCode");
 
-        if (childId == null || taskId == null || amount == null) {
-            return Result.error("childId、taskId和amount不能为空");
+        if (memberId == null || taskId == null || amount == null) {
+            return Result.error("memberId、taskId和amount不能为空");
         }
 
-        EnergyLog energyLog = energyService.grantEnergy(childId, taskId, amount, dimensionCode);
+        EnergyLog energyLog = energyService.grantEnergy(memberId, taskId, amount, dimensionCode);
         return Result.success(energyLog);
     }
 
@@ -121,19 +124,20 @@ public class EnergyController {
     @Operation(summary = "心愿兑换扣除能量")
     @PostMapping("/deduct-for-wish")
     public Result<Boolean> deductForWish(
-            @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         Long wishId = params.get("wishId") != null
                 ? Long.valueOf(params.get("wishId").toString()) : null;
         Long amount = params.get("amount") != null
                 ? Long.valueOf(params.get("amount").toString()) : null;
 
-        if (childId == null || wishId == null || amount == null) {
-            return Result.error("childId、wishId和amount不能为空");
+        if (memberId == null || wishId == null || amount == null) {
+            return Result.error("memberId、wishId和amount不能为空");
         }
 
-        Boolean result = energyService.deductForWish(childId, wishId, amount);
+        Boolean result = energyService.deductForWish(memberId, wishId, amount);
         return Result.success(result);
     }
 

+ 5 - 4
cfc-backend/src/main/java/com/etotem/cfc/controller/FamilyChallengeController.java

@@ -31,13 +31,14 @@ public class FamilyChallengeController {
     }
 
     @PostMapping("/progress")
-    public Result<Void> updateProgress(@RequestBody Map<String, Object> params) {
+    public Result<Void> updateProgress(@RequestBody Map<String, Object> params,
+                                       @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long challengeId = params.get("challengeId") != null
                 ? Long.valueOf(params.get("challengeId").toString()) : null;
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         int delta = params.get("delta") != null
                 ? Integer.parseInt(params.get("delta").toString()) : 0;
-        return familyChallengeService.updateProgress(challengeId, childId, delta);
+        return familyChallengeService.updateProgress(challengeId, memberId, delta);
     }
 }

+ 8 - 8
cfc-backend/src/main/java/com/etotem/cfc/controller/GameRecordController.java

@@ -22,7 +22,7 @@ public class GameRecordController {
     @Operation(summary = "保存游戏记录")
     @PostMapping("/record")
     public Result<Map<String, Object>> saveRecord(@RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
+        Long memberId = Long.valueOf(body.get("memberId").toString());
         String gameCode = (String) body.get("gameCode");
         Integer score = body.get("score") != null
                 ? Integer.valueOf(body.get("score").toString()) : null;
@@ -32,34 +32,34 @@ public class GameRecordController {
         Integer pointsEarned = body.get("pointsEarned") != null
                 ? Integer.valueOf(body.get("pointsEarned").toString()) : 0;
 
-        gameRecordService.saveRecord(childId, gameCode, completionTime, score, difficulty, pointsEarned);
+        gameRecordService.saveRecord(memberId, gameCode, completionTime, score, difficulty, pointsEarned);
         return Result.success(Collections.singletonMap("saved", true));
     }
 
     @Operation(summary = "获取游戏记录历史")
     @PostMapping("/history")
     public Result<Map<String, Object>> getHistory(@RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
+        Long memberId = Long.valueOf(body.get("memberId").toString());
         String gameCode = (String) body.get("gameCode");
         Integer page = body.get("page") != null
                 ? Integer.valueOf(body.get("page").toString()) : 1;
         Integer size = body.get("size") != null
                 ? Integer.valueOf(body.get("size").toString()) : 20;
-        return Result.success(gameRecordService.getHistory(childId, gameCode, page, size));
+        return Result.success(gameRecordService.getHistory(memberId, gameCode, page, size));
     }
 
     @Operation(summary = "获取各游戏最佳成绩")
     @PostMapping("/best")
     public Result<List<Map<String, Object>>> getBestScores(@RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
-        return Result.success(gameRecordService.getBestScores(childId));
+        Long memberId = Long.valueOf(body.get("memberId").toString());
+        return Result.success(gameRecordService.getBestScores(memberId));
     }
 
     @Operation(summary = "获取游戏统计概览")
     @PostMapping("/stats")
     public Result<Map<String, Object>> getStats(@RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
-        return Result.success(gameRecordService.getStats(childId));
+        Long memberId = Long.valueOf(body.get("memberId").toString());
+        return Result.success(gameRecordService.getStats(memberId));
     }
 
     @Operation(summary = "获取排行榜")

+ 5 - 4
cfc-backend/src/main/java/com/etotem/cfc/controller/HealthAlertController.java

@@ -21,10 +21,11 @@ public class HealthAlertController {
 
     @Operation(summary = "获取活跃预警列表")
     @PostMapping("/list")
-    public Result<List<HealthAlert>> list(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        return Result.success(healthAlertService.getActiveAlerts(childId));
+    public Result<List<HealthAlert>> list(@RequestBody Map<String, Object> params,
+                                          @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        return Result.success(healthAlertService.getActiveAlerts(memberId));
     }
 
     @Operation(summary = "关闭预警")

+ 17 - 14
cfc-backend/src/main/java/com/etotem/cfc/controller/HealthCheckinController.java

@@ -27,11 +27,12 @@ public class HealthCheckinController {
     @PostMapping("/list")
     public Result<List<HealthCheckin>> list(
             @RequestBody Map<String, Object> params,
-            @RequestAttribute("userId") Long userId) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
+            @RequestAttribute("userId") Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String yearMonth = (String) params.get("yearMonth");
-        List<HealthCheckin> list = healthCheckinService.getCheckins(userId, childId, yearMonth);
+        List<HealthCheckin> list = healthCheckinService.getCheckins(userId, memberId, yearMonth);
         return Result.success(list);
     }
 
@@ -39,14 +40,15 @@ public class HealthCheckinController {
     @PostMapping("/create")
     public Result<HealthCheckin> create(
             @RequestBody Map<String, Object> params,
-            @RequestAttribute("userId") Long userId) {
+            @RequestAttribute("userId") Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         HealthCheckin checkin = new HealthCheckin();
         checkin.setUserId(userId);
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        checkin.setChildId(childId);
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        checkin.setChildId(memberId);
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
         // Parse checkinDate (default today)
         Object dateObj = params.get("checkinDate");
@@ -93,10 +95,11 @@ public class HealthCheckinController {
     @PostMapping("/stats")
     public Result<Map<String, Object>> stats(
             @RequestBody Map<String, Object> params,
-            @RequestAttribute(value = "userId", required = false) Long userId) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        long total = healthCheckinService.countCheckins(childId);
+            @RequestAttribute(value = "userId", required = false) Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        long total = healthCheckinService.countCheckins(memberId);
         java.util.Map<String, Object> stats = new java.util.HashMap<String, Object>();
         stats.put("totalCheckins", total);
         stats.put("totalEnergy", total * 5);

+ 55 - 52
cfc-backend/src/main/java/com/etotem/cfc/controller/HealthReportController.java

@@ -115,12 +115,13 @@ public class HealthReportController {
     @PostMapping("/report/create")
     public Result<HealthReport> createReport(
             @RequestBody Map<String, Object> params,
-            @RequestAttribute("userId") Long userId) {
+            @RequestAttribute("userId") Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
 
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
 
         String reportType = (String) params.get("reportType");
@@ -130,7 +131,7 @@ public class HealthReportController {
 
         // 构建报告主体
         HealthReport report = new HealthReport();
-        report.setUserId(childId);
+        report.setUserId(memberId);
         report.setReportType(reportType);
         report.setOverallScore(params.get("overallScore") != null
                 ? Integer.valueOf(params.get("overallScore").toString()) : null);
@@ -192,13 +193,14 @@ public class HealthReportController {
     @Operation(summary = "获取最新健康报告")
     @PostMapping("/report/latest")
     public Result<HealthReport> getLatestReport(
-            @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        HealthReport report = healthReportService.getLatestReport(childId);
+        HealthReport report = healthReportService.getLatestReport(memberId);
         return Result.success(report);
     }
 
@@ -208,13 +210,14 @@ public class HealthReportController {
     @Operation(summary = "获取健康报告列表")
     @PostMapping("/report/list")
     public Result<List<HealthReport>> listReports(
-            @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        List<HealthReport> reports = healthReportService.getUserReports(childId);
+        List<HealthReport> reports = healthReportService.getUserReports(memberId);
         return Result.success(reports);
     }
 
@@ -253,13 +256,14 @@ public class HealthReportController {
     @Operation(summary = "获取身体维度数据详情")
     @PostMapping("/body/detail")
     public Result<List<HealthIndicator>> getBodyDetail(
-            @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        List<HealthIndicator> detail = healthReportService.getBodyDetail(childId);
+        List<HealthIndicator> detail = healthReportService.getBodyDetail(memberId);
         return Result.success(detail);
     }
 
@@ -407,14 +411,13 @@ public class HealthReportController {
             @RequestParam(value = "type", defaultValue = "auto") String type,
             @RequestParam(value = "familyId", required = false) Long familyId,
             @RequestParam(value = "memberId", required = false) Long memberId,
-            @RequestParam(value = "childId", required = false) Long childId,
             @RequestAttribute("userId") Long userId) {
 
         if ("tongue".equals(type)) {
             if (memberId == null) {
                 return Result.error("memberId is required for tongue diagnosis");
             }
-            Map<String, Object> result = tongueDiagnosisService.parsePreview(file, memberId, childId);
+            Map<String, Object> result = tongueDiagnosisService.parsePreview(file, memberId);
             return Result.success(result);
         }
 
@@ -757,14 +760,14 @@ public class HealthReportController {
     @PostMapping("/nutrition/deficiency")
     public Result<List<NutritionDeficiencyRecord>> getDeficiencyAnalysis(
             @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : null;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
         Long reportId = params.get("reportId") != null
                 ? Long.valueOf(params.get("reportId").toString()) : null;
-        List<NutritionDeficiencyRecord> records = nutritionDeficiencyService.analyzeDeficiency(childId, reportId);
+        List<NutritionDeficiencyRecord> records = nutritionDeficiencyService.analyzeDeficiency(memberId, reportId);
         return Result.success(records);
     }
 
@@ -772,12 +775,12 @@ public class HealthReportController {
     @PostMapping("/nutrition/profile")
     public Result<Map<String, Object>> getNutritionProfile(
             @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : null;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        Map<String, Object> profile = childNutritionProfileService.getProfile(childId);
+        Map<String, Object> profile = childNutritionProfileService.getProfile(memberId);
         return Result.success(profile);
     }
 
@@ -785,12 +788,12 @@ public class HealthReportController {
     @PostMapping("/nutrition/deficiency-summary")
     public Result<Map<String, Object>> getDeficiencySummary(
             @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : null;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        Map<String, Object> summary = childNutritionProfileService.getDeficiencySummary(childId);
+        Map<String, Object> summary = childNutritionProfileService.getDeficiencySummary(memberId);
         return Result.success(summary);
     }
 
@@ -798,12 +801,12 @@ public class HealthReportController {
     @PostMapping("/nutrition/trend")
     public Result<Map<String, Object>> getReportTrendData(
             @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : null;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        Map<String, Object> trend = childNutritionProfileService.getReportTrendData(childId);
+        Map<String, Object> trend = childNutritionProfileService.getReportTrendData(memberId);
         return Result.success(trend);
     }
 
@@ -811,13 +814,13 @@ public class HealthReportController {
     @PostMapping("/analysis")
     public Result<Map<String, Object>> getHealthAnalysis(
             @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : null;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        HealthAnalysisResult analysisResult = healthAnalysisService.analyzeLatestByUser(childId);
-        List<NutritionDeficiencyRecord> deficiencyRecords = nutritionDeficiencyService.analyzeDeficiency(childId, null);
+        HealthAnalysisResult analysisResult = healthAnalysisService.analyzeLatestByUser(memberId);
+        List<NutritionDeficiencyRecord> deficiencyRecords = nutritionDeficiencyService.analyzeDeficiency(memberId, null);
 
         Map<String, Object> result = new java.util.HashMap<>();
         result.put("analysis", analysisResult);

+ 10 - 8
cfc-backend/src/main/java/com/etotem/cfc/controller/HealthScoreController.java

@@ -23,17 +23,19 @@ public class HealthScoreController {
 
     @Operation(summary = "获取成员健康积分和等级")
     @PostMapping("/info")
-    public Result<Map<String, Object>> info(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        return Result.success(healthLevelService.getMemberLevelInfo(childId));
+    public Result<Map<String, Object>> info(@RequestBody Map<String, Object> params,
+                                            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        return Result.success(healthLevelService.getMemberLevelInfo(memberId));
     }
 
     @Operation(summary = "获取连续打卡天数")
     @PostMapping("/streak")
-    public Result<Integer> streak(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        return Result.success(healthScoreService.calculateStreakDays(childId));
+    public Result<Integer> streak(@RequestBody Map<String, Object> params,
+                                  @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        return Result.success(healthScoreService.calculateStreakDays(memberId));
     }
 }

+ 5 - 4
cfc-backend/src/main/java/com/etotem/cfc/controller/HealthTimelineController.java

@@ -21,11 +21,12 @@ public class HealthTimelineController {
 
     @Operation(summary = "获取健康时间线")
     @PostMapping("/list")
-    public Result<List<HealthTimelineEvent>> list(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
+    public Result<List<HealthTimelineEvent>> list(@RequestBody Map<String, Object> params,
+                                                  @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         int limit = params.get("limit") != null
                 ? Integer.parseInt(params.get("limit").toString()) : 20;
-        return Result.success(healthTimelineService.getTimeline(childId, limit));
+        return Result.success(healthTimelineService.getTimeline(memberId, limit));
     }
 }

+ 5 - 3
cfc-backend/src/main/java/com/etotem/cfc/controller/MealRecommendController.java

@@ -88,11 +88,13 @@ public class MealRecommendController {
     @PostMapping("/log")
     public Result<Map<String, Object>> createLog(
             @RequestAttribute("userId") Long userId,
-            @RequestBody Map<String, Object> params) {
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         MealLog logEntry = new MealLog();
         logEntry.setUserId(userId);
-        if (params.get("childId") != null) {
-            logEntry.setChildId(Long.valueOf(params.get("childId").toString()));
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId != null) {
+            logEntry.setChildId(memberId);
         }
         logEntry.setMealType((String) params.get("mealType"));
         logEntry.setFoods(params.get("foods") != null ? params.get("foods").toString() : "[]");

+ 18 - 15
cfc-backend/src/main/java/com/etotem/cfc/controller/MicroActionController.java

@@ -34,11 +34,12 @@ public class MicroActionController {
     @PostMapping("/today")
     public Result<Map<String, Object>> today(
             @RequestBody Map<String, Object> params,
-            @RequestAttribute("userId") Long userId) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        MicroAction action = microActionService.getTodayAction(childId);
-        boolean completed = childId != null && microActionService.hasCompletedToday(childId);
+            @RequestAttribute("userId") Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        MicroAction action = microActionService.getTodayAction(memberId);
+        boolean completed = memberId != null && microActionService.hasCompletedToday(memberId);
 
         Map<String, Object> result = new HashMap<>();
         result.put("action", action);
@@ -50,19 +51,20 @@ public class MicroActionController {
     @PostMapping("/complete")
     public Result<MicroActionRecord> complete(
             @RequestBody Map<String, Object> params,
-            @RequestAttribute("userId") Long userId) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
+            @RequestAttribute("userId") Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         Long actionId = params.get("actionId") != null
                 ? Long.valueOf(params.get("actionId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
         if (actionId == null) {
             return Result.error("actionId不能为空");
         }
         try {
-            MicroActionRecord record = microActionService.completeAction(userId, childId, actionId);
+            MicroActionRecord record = microActionService.completeAction(userId, memberId, actionId);
             return Result.success(record);
         } catch (RuntimeException e) {
             return Result.error(e.getMessage());
@@ -72,10 +74,11 @@ public class MicroActionController {
     @Operation(summary = "检查今日是否已完成")
     @PostMapping("/check-today")
     public Result<Map<String, Object>> checkToday(
-            @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        boolean completed = childId != null && microActionService.hasCompletedToday(childId);
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        boolean completed = memberId != null && microActionService.hasCompletedToday(memberId);
 
         Map<String, Object> result = new HashMap<>();
         result.put("completed", completed);

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/MiniGameController.java

@@ -54,7 +54,7 @@ public class MiniGameController {
             @RequestAttribute("userId") Long userId,
             @RequestBody @Valid CompleteGameDTO dto) {
         Map<String, Object> result = miniGameService.completeGame(
-                dto.getChildId(), dto.getGameCode(),
+                dto.getMemberId(), dto.getGameCode(),
                 dto.getCompletionTime(), dto.getScore());
         return Result.success(result);
     }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/PackagePaymentController.java

@@ -89,7 +89,7 @@ public class PackagePaymentController {
     @PostMapping("/apply")
     public Result<TaskPlanInstance> applyAfterPayment(@RequestBody Map<String, Object> params) {
         Long orderId = Long.valueOf(params.get("orderId").toString());
-        Long childId = Long.valueOf(params.get("childId").toString());
+        Long memberId = Long.valueOf(params.get("memberId").toString());
         java.util.List<Long> selectedItemIds = null;
         if (params.get("selectedItemIds") instanceof java.util.List) {
             selectedItemIds = new java.util.ArrayList<>();
@@ -106,7 +106,7 @@ public class PackagePaymentController {
         // 应用任务模板
         com.etotem.cfc.dto.ApplyPackageDTO dto = new com.etotem.cfc.dto.ApplyPackageDTO();
         dto.setPackageId(order.getPackageId());
-        dto.setChildId(childId);
+        dto.setMemberId(memberId);
         dto.setSelectedItemIds(selectedItemIds);
         
         TaskPlanInstance instance = planService.applyPackage(dto, order.getFamilyId());

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/PointsExchangeController.java

@@ -46,13 +46,13 @@ public class PointsExchangeController {
     public Result<PointsExchangeRecord> exchangeProduct(@RequestBody Map<String, Object> params,
                                                           @RequestAttribute("userId") Long userId) {
         Long productId = params.get("productId") != null ? Long.valueOf(params.get("productId").toString()) : null;
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : null;
         Integer quantity = params.get("quantity") != null ? Integer.valueOf(params.get("quantity").toString()) : 1;
         if (productId == null) {
             return Result.error("商品ID不能为空");
         }
         try {
-            PointsExchangeRecord record = pointsExchangeService.exchangeProduct(userId, childId, productId, quantity);
+            PointsExchangeRecord record = pointsExchangeService.exchangeProduct(userId, memberId, productId, quantity);
             return Result.success(record);
         } catch (RuntimeException e) {
             return Result.error(e.getMessage());

+ 8 - 8
cfc-backend/src/main/java/com/etotem/cfc/controller/ReportStatsController.java

@@ -39,11 +39,11 @@ public class ReportStatsController {
     @Operation(summary = "孩子数据概览")
     @PostMapping("/child/overview")
     public Result<Map<String, Object>> childOverview(@RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
+        Long memberId = Long.valueOf(body.get("memberId").toString());
         Map<String, Object> result = new HashMap<>();
 
         // 基础信息
-        FamilyMember child = familyMemberMapper.selectById(childId);
+        FamilyMember child = familyMemberMapper.selectById(memberId);
         result.put("totalPoints", child != null ? child.getTotalPoints() : 0);
 
         // 月活跃天数(当月有积分变动的天数)
@@ -57,7 +57,7 @@ public class ReportStatsController {
 
         List<PointsLog> monthLogs = pointsLogMapper.selectList(
                 new LambdaQueryWrapper<PointsLog>()
-                        .eq(PointsLog::getChildId, childId)
+                        .eq(PointsLog::getChildId, memberId)
                         .ge(PointsLog::getCreatedAt, monthStart)
                         .orderByAsc(PointsLog::getCreatedAt));
 
@@ -71,7 +71,7 @@ public class ReportStatsController {
         result.put("monthActiveDays", activeDays.size());
 
         // 任务统计
-        List<Task> tasks = taskService.getAllTasksByChild(childId);
+        List<Task> tasks = taskService.getAllTasksByChild(memberId);
         long taskTotal = tasks.size();
         long taskCompleted = tasks.stream().filter(t -> "completed".equals(t.getStatus())).count();
         long taskPending = tasks.stream().filter(t -> "pending".equals(t.getStatus())).count();
@@ -86,7 +86,7 @@ public class ReportStatsController {
         result.put("taskStats", taskStats);
 
         // 游戏统计
-        List<GameRecord> records = gameRecordService.listByChildId(childId);
+        List<GameRecord> records = gameRecordService.listByChildId(memberId);
         long gameTotal = records.size();
         int gameTotalPoints = records.stream().mapToInt(GameRecord::getPointsEarned).sum();
         int bestScore = records.stream().mapToInt(GameRecord::getScore).max().orElse(0);
@@ -107,7 +107,7 @@ public class ReportStatsController {
 
         List<PointsLog> recentLogs = pointsLogMapper.selectList(
                 new LambdaQueryWrapper<PointsLog>()
-                        .eq(PointsLog::getChildId, childId)
+                        .eq(PointsLog::getChildId, memberId)
                         .ge(PointsLog::getCreatedAt, sevenDaysAgo)
                         .orderByAsc(PointsLog::getCreatedAt));
 
@@ -159,7 +159,7 @@ public class ReportStatsController {
 
         for (FamilyMember child : children) {
             Map<String, Object> childStat = new HashMap<>();
-            childStat.put("childId", child.getId());
+            childStat.put("memberId", child.getId());
             childStat.put("childName", child.getNickname());
 
             List<Task> tasks = taskService.getAllTasksByChild(child.getId());
@@ -203,7 +203,7 @@ public class ReportStatsController {
         for (FamilyMember child : children) {
             Map<String, Object> item = new HashMap<>();
             item.put("rank", rank++);
-            item.put("childId", child.getId());
+            item.put("memberId", child.getId());
             item.put("childName", child.getNickname());
             item.put("points", child.getTotalPoints());
             ranking.add(item);

+ 4 - 4
cfc-backend/src/main/java/com/etotem/cfc/controller/ReportSurveyController.java

@@ -31,12 +31,12 @@ public class ReportSurveyController {
             @RequestAttribute("userId") Long userId) {
         Long reportId = params.get("reportId") != null
                 ? Long.valueOf(params.get("reportId").toString()) : null;
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (reportId == null || childId == null) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : null;
+        if (reportId == null || memberId == null) {
             return Result.error("reportId和childId不能为空");
         }
-        ReportSurvey survey = reportSurveyService.createSurvey(reportId, userId, childId);
+        ReportSurvey survey = reportSurveyService.createSurvey(reportId, userId, memberId);
         return Result.success(survey);
     }
 

+ 4 - 4
cfc-backend/src/main/java/com/etotem/cfc/controller/StreakController.java

@@ -31,10 +31,10 @@ public class StreakController {
      * 获取孩子的打卡进度信息
      */
     @Operation(summary = "获取打卡进度")
-    @PostMapping("/progress/{childId}")
+    @PostMapping("/progress/{memberId}")
     public Result<Map<String, Object>> getStreakProgress(
             @RequestAttribute(value = "userId", required = false) Long userId,
-            @PathVariable Long childId) {
+            @PathVariable Long memberId) {
 
         // 权限校验:验证用户是否有权限查看该孩子
         if (userId != null) {
@@ -43,7 +43,7 @@ public class StreakController {
                 return Result.error("用户不存在");
             }
 
-            FamilyMember child = familyMemberMapper.selectById(childId);
+            FamilyMember child = familyMemberMapper.selectById(memberId);
             if (child == null) {
                 return Result.error("孩子不存在");
             }
@@ -54,7 +54,7 @@ public class StreakController {
             }
         }
 
-        Map<String, Object> progress = streakService.getStreakProgress(childId);
+        Map<String, Object> progress = streakService.getStreakProgress(memberId);
         return Result.success(progress);
     }
 

+ 9 - 9
cfc-backend/src/main/java/com/etotem/cfc/controller/admin/AdminController.java

@@ -403,7 +403,7 @@ public class AdminController {
     public Result<Page<PointsLog>> getPointsLogs(@RequestBody Map<String, Object> params) {
         Integer page = 1;
         Integer size = 10;
-        Long childId = null;
+        Long memberId = null;
         
         // 安全解析page
         if (params.get("page") != null) {
@@ -428,11 +428,11 @@ public class AdminController {
         }
         
         // 安全解析childId
-        if (params.get("childId") != null) {
-            if (params.get("childId") instanceof Number) {
-                childId = ((Number) params.get("childId")).longValue();
+        if (params.get("memberId") != null) {
+            if (params.get("memberId") instanceof Number) {
+                memberId = ((Number) params.get("memberId")).longValue();
             } else {
-                try { childId = Long.parseLong(params.get("childId").toString()); } catch (Exception e) {}
+                try { memberId = Long.parseLong(params.get("memberId").toString()); } catch (Exception e) {}
             }
         }
         
@@ -440,8 +440,8 @@ public class AdminController {
         
         Page<PointsLog> pageParam = new Page<>(page, size);
         LambdaQueryWrapper<PointsLog> wrapper = new LambdaQueryWrapper<>();
-        if (childId != null) {
-            wrapper.eq(PointsLog::getChildId, childId);
+        if (memberId != null) {
+            wrapper.eq(PointsLog::getChildId, memberId);
         }
         if (type != null && !type.isEmpty()) {
             wrapper.eq(PointsLog::getType, type);
@@ -1068,7 +1068,7 @@ public class AdminController {
             Map<String, Object> item = new HashMap<>();
             item.put("id", app.getId());
             item.put("familyId", app.getFamilyId());
-            item.put("childId", app.getChildId());
+            item.put("memberId", app.getChildId());
             item.put("appointmentDate", app.getAppointmentDate());
             item.put("appointmentTime", app.getAppointmentTime());
             item.put("durationMinutes", app.getDurationMinutes());
@@ -1159,7 +1159,7 @@ public class AdminController {
             item.put("id", app.getId());
             item.put("familyId", app.getFamilyId());
             item.put("userId", app.getUserId());
-            item.put("childId", app.getChildId());
+            item.put("memberId", app.getChildId());
             item.put("guideId", app.getGuideId());
             item.put("teacherId", app.getTeacherId());
             item.put("packageId", app.getPackageId());

+ 9 - 8
cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentAppointmentController.java

@@ -40,9 +40,10 @@ public class AssessmentAppointmentController {
     @PostMapping("/create")
     public Result<Map<String, Object>> createAppointment(
             @RequestAttribute("userId") Long userId,
-            @RequestBody Map<String, Object> body) {
+            @RequestBody Map<String, Object> body,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
 
-        Long childId = body.get("childId") != null ? Long.valueOf(body.get("childId").toString()) : null;
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         Long guideId = body.get("guideId") != null ? Long.valueOf(body.get("guideId").toString()) : null;
         Long assessorId = body.get("assessorId") != null ? Long.valueOf(body.get("assessorId").toString()) : null;
         String appointmentDate = body.get("appointmentDate") != null ? body.get("appointmentDate").toString() : null;
@@ -50,8 +51,8 @@ public class AssessmentAppointmentController {
         String notes = body.get("notes") != null ? body.get("notes").toString() : null;
         Long quotaId = body.get("quotaId") != null ? Long.valueOf(body.get("quotaId").toString()) : null;
 
-        if (childId == null || quotaId == null) {
-            return Result.error("childId和quotaId不能为空");
+        if (memberId == null || quotaId == null) {
+            return Result.error("memberId和quotaId不能为空");
         }
         if (assessorId == null && guideId == null) {
             return Result.error("assessorId或guideId必须提供一个");
@@ -61,7 +62,7 @@ public class AssessmentAppointmentController {
         if (user == null) return Result.error("用户不存在");
 
         // 消耗一次额度
-        int consumed = quotaService.consumeQuota(quotaId, childId);
+        int consumed = quotaService.consumeQuota(quotaId, memberId);
         if (consumed <= 0) {
             return Result.error("额度不足或已过期");
         }
@@ -72,13 +73,13 @@ public class AssessmentAppointmentController {
 
         // 创建预约
         AssessmentAppointment appointment = appointmentService.createAppointment(
-                userId, childId, guideId, assessorId, null, appointmentDate, appointmentTime, notes);
+                userId, memberId, guideId, assessorId, null, appointmentDate, appointmentTime, notes);
 
         // 创建新执行记录(dan_assessment_executions,含 assessor 角色)
         Long finalAssessorId = assessorId != null ? assessorId : guideId;
         DanAssessmentExecution exec = danAssessmentExecutionService.createExecution(
                 quota.getProductOrderId(), // assessmentOrderId 复用 shop productOrderId
-                childId,
+                memberId,
                 quota.getFamilyId(),
                 quotaId,
                 finalAssessorId,
@@ -146,7 +147,7 @@ public class AssessmentAppointmentController {
     private Map<String, Object> toMap(AssessmentAppointment appt) {
         Map<String, Object> map = new HashMap<>();
         map.put("id", appt.getId());
-        map.put("childId", appt.getChildId());
+        map.put("memberId", appt.getChildId());
         map.put("guideId", appt.getGuideId());
         map.put("assessorId", appt.getAssessorId());
         map.put("appointmentDate", appt.getAppointmentDate());

+ 21 - 18
cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentComparisonController.java

@@ -31,13 +31,14 @@ public class AssessmentComparisonController {
     @Operation(summary = "对比孩子首次与最新测评")
     @PostMapping("/by-child")
     public Result<AssessmentComparisonService.CompareResult> compareByChild(
-            @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        AssessmentComparisonService.CompareResult result = comparisonService.compareByChild(childId);
+        AssessmentComparisonService.CompareResult result = comparisonService.compareByChild(memberId);
         if (result == null) {
             return Result.error("至少需要两次完成测评才能对比");
         }
@@ -47,15 +48,16 @@ public class AssessmentComparisonController {
     @Operation(summary = "对比孩子单维度变化")
     @PostMapping("/by-child-dimension")
     public Result<AssessmentComparisonService.DimensionDelta> compareByChildDimension(
-            @RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
+            @RequestBody Map<String, Object> params,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String dimensionCode = (String) params.get("dimensionCode");
-        if (childId == null || dimensionCode == null) {
-            return Result.error("childId和dimensionCode不能为空");
+        if (memberId == null || dimensionCode == null) {
+            return Result.error("memberId和dimensionCode不能为空");
         }
         AssessmentComparisonService.DimensionDelta result =
-                comparisonService.compareByChildAndDimension(childId, dimensionCode);
+                comparisonService.compareByChildAndDimension(memberId, dimensionCode);
         if (result == null) {
             return Result.error("暂无足够数据");
         }
@@ -85,13 +87,14 @@ public class AssessmentComparisonController {
 
     @Operation(summary = "获取进步叙事")
     @PostMapping("/narrative")
-    public Result<String> getNarrative(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+    public Result<String> getNarrative(@RequestBody Map<String, Object> params,
+                                       @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        String narrative = comparisonService.getProgressNarrative(childId);
+        String narrative = comparisonService.getProgressNarrative(memberId);
         return Result.success(narrative);
     }
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentQuotaController.java

@@ -64,7 +64,7 @@ public class AssessmentQuotaController {
         vo.setId(q.getId());
         vo.setQuotaNo(q.getQuotaNo());
         vo.setFamilyId(q.getFamilyId());
-        vo.setChildId(q.getChildId());
+        vo.setMemberId(q.getChildId());
         vo.setProductOrderId(q.getProductOrderId());
         vo.setProductId(q.getProductId());
         vo.setProductName(q.getProductName());

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentReportController.java

@@ -52,7 +52,7 @@ public class AssessmentReportController {
     @PostMapping("/upload")
     public Result<DanAssessmentResult> uploadReport(
             @RequestParam("file") MultipartFile file,
-            @RequestParam("childId") Long childId,
+            @RequestParam("memberId") Long memberId,
             @RequestParam(value = "notes", required = false) String notes) {
 
         if (file == null || file.isEmpty()) {
@@ -65,7 +65,7 @@ public class AssessmentReportController {
         }
 
         DanAssessmentResult result = new DanAssessmentResult();
-        result.setChildId(childId);
+        result.setChildId(memberId);
         result.setStatus("draft");
         result.setSource(DanAssessmentResult.SOURCE_PARENT_UPLOAD);
         result.setProcessDesc(notes);

+ 17 - 15
cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/AssessmentResultController.java

@@ -29,21 +29,22 @@ public class AssessmentResultController {
 
     @Operation(summary = "获取孩子最新认知测评结果")
     @PostMapping("/latest-result")
-    public Result<AssessmentResultDTO> getLatestResult(@RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+    public Result<AssessmentResultDTO> getLatestResult(@RequestBody Map<String, Object> body,
+                                                       @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
 
-        DanAssessmentResult result = cognitiveService.getChildLatestResult(childId);
+        DanAssessmentResult result = cognitiveService.getChildLatestResult(memberId);
         if (result == null) {
             return Result.success(null);
         }
 
         AssessmentResultDTO dto = new AssessmentResultDTO();
-        dto.setChildId(result.getChildId());
+        dto.setMemberId(result.getChildId());
         dto.setChildName(result.getChildName());
         dto.setOverallScore(result.getOverallScore());
         dto.setAttentionScore(result.getAttentionScore());
@@ -61,20 +62,21 @@ public class AssessmentResultController {
 
     @Operation(summary = "获取孩子测评历史记录")
     @PostMapping("/history")
-    public Result<List<AssessmentHistoryItemDTO>> getHistory(@RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
+    public Result<List<AssessmentHistoryItemDTO>> getHistory(@RequestBody Map<String, Object> body,
+                                                             @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
         int size = body.get("size") != null
                 ? Integer.parseInt(body.get("size").toString())
                 : 5;
 
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
 
         LambdaQueryWrapper<DanAssessmentResult> wrapper = new LambdaQueryWrapper<DanAssessmentResult>()
-                .eq(DanAssessmentResult::getChildId, childId)
+                .eq(DanAssessmentResult::getChildId, memberId)
                 .eq(DanAssessmentResult::getStatus, "completed")
                 .orderByDesc(DanAssessmentResult::getAssessmentDate)
                 .last("LIMIT " + size);

+ 48 - 41
cfc-backend/src/main/java/com/etotem/cfc/controller/assessment/CognitiveController.java

@@ -36,21 +36,22 @@ public class CognitiveController {
     @Operation(summary = "获取孩子最新六维认知得分")
     @PostMapping("/child")
     public Result<Map<String, Object>> getChildCognitiveScores(
-            @RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+            @RequestBody Map<String, Object> body,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
 
-        DanAssessmentResult result = cognitiveService.getChildLatestResult(childId);
+        DanAssessmentResult result = cognitiveService.getChildLatestResult(memberId);
         if (result == null) {
             return Result.success(null);
         }
 
         Map<String, Object> scores = new LinkedHashMap<>();
-        scores.put("childId", result.getChildId());
+        scores.put("memberId", result.getChildId());
         scores.put("childName", result.getChildName());
         scores.put("attentionScore", result.getAttentionScore());
         scores.put("focusScore", result.getFocusScore());
@@ -75,7 +76,7 @@ public class CognitiveController {
         for (Map.Entry<Long, DanAssessmentResult> entry : results.entrySet()) {
             DanAssessmentResult r = entry.getValue();
             Map<String, Object> item = new LinkedHashMap<>();
-            item.put("childId", r.getChildId());
+            item.put("memberId", r.getChildId());
             item.put("childName", r.getChildName());
             item.put("attentionScore", r.getAttentionScore());
             item.put("focusScore", r.getFocusScore());
@@ -95,10 +96,11 @@ public class CognitiveController {
     @Operation(summary = "更新孩子认知维度得分")
     @PostMapping("/update")
     public Result<String> updateCognitiveScore(
-            @RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
+            @RequestBody Map<String, Object> body,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
         String dimension = body.get("dimension") != null
                 ? body.get("dimension").toString()
                 : null;
@@ -106,8 +108,8 @@ public class CognitiveController {
                 ? Integer.valueOf(body.get("score").toString())
                 : null;
 
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
         if (dimension == null || dimension.isEmpty()) {
             return Result.error("dimension不能为空");
@@ -116,7 +118,7 @@ public class CognitiveController {
             return Result.error("score不能为空");
         }
 
-        boolean success = cognitiveService.updateChildDimensionScore(childId, dimension, score);
+        boolean success = cognitiveService.updateChildDimensionScore(memberId, dimension, score);
         if (!success) {
             return Result.error("更新失败,未找到最新测评结果或维度不存在");
         }
@@ -126,15 +128,16 @@ public class CognitiveController {
     @Operation(summary = "获取认知训练建议(根据最新DAN评估生成家庭行动清单)")
     @PostMapping("/recommendations")
     public Result<CognitiveRecommendationDTO> getRecommendations(
-            @RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+            @RequestBody Map<String, Object> body,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
 
-        CognitiveRecommendationDTO rec = cognitiveTrainingConfigService.generateRecommendations(childId);
+        CognitiveRecommendationDTO rec = cognitiveTrainingConfigService.generateRecommendations(memberId);
         if (rec == null) {
             return Result.error("暂无评估数据,请先完成认知评估");
         }
@@ -145,16 +148,18 @@ public class CognitiveController {
     @PostMapping("/recommendations/create-task")
     public Result<Long> createTaskFromRecommendation(
             @RequestAttribute("userId") Long userId,
-            @RequestBody CreateCognitiveTaskDTO dto) {
-        if (dto.getChildId() == null) {
-            return Result.error("childId不能为空");
+            @RequestBody CreateCognitiveTaskDTO dto,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = dto.getMemberId() != null ? dto.getMemberId() : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
         if (dto.getDimensionKey() == null) {
             return Result.error("dimensionKey不能为空");
         }
 
         Long taskId = cognitiveTrainingConfigService.createTaskFromRecommendation(
-                userId, dto.getChildId(), dto.getDimensionKey(), dto.getTaskIndex());
+                userId, memberId, dto.getDimensionKey(), dto.getTaskIndex());
         if (taskId == null) {
             return Result.error("创建任务失败,请检查评估数据");
         }
@@ -163,15 +168,16 @@ public class CognitiveController {
 
     @Operation(summary = "获取认知维度百分位常模(与同龄人对比)")
     @PostMapping("/norms")
-    public Result<Map<String, Object>> getNorms(@RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+    public Result<Map<String, Object>> getNorms(@RequestBody Map<String, Object> body,
+                                                @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
 
-        Map<String, Object> norms = cognitiveNormService.getNorms(childId);
+        Map<String, Object> norms = cognitiveNormService.getNorms(memberId);
         if (norms.isEmpty()) {
             return Result.error("暂无常模数据");
         }
@@ -180,20 +186,21 @@ public class CognitiveController {
 
     @Operation(summary = "获取认知维度历史趋势(六维分数+综合分按时序排列)")
     @PostMapping("/trend")
-    public Result<List<CognitiveTrendItemDTO>> getTrend(@RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
+    public Result<List<CognitiveTrendItemDTO>> getTrend(@RequestBody Map<String, Object> body,
+                                                        @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
         int limit = body.get("limit") != null
                 ? Integer.parseInt(body.get("limit").toString())
                 : 5;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
 
         List<DanAssessmentResult> results = danAssessmentResultMapper.selectList(
                 new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<DanAssessmentResult>()
-                        .eq(DanAssessmentResult::getChildId, childId)
+                        .eq(DanAssessmentResult::getChildId, memberId)
                         .eq(DanAssessmentResult::getStatus, "completed")
                         .orderByDesc(DanAssessmentResult::getAssessmentDate)
                         .last("LIMIT " + limit)

+ 8 - 6
cfc-backend/src/main/java/com/etotem/cfc/controller/content/ArticleCommentController.java

@@ -71,11 +71,12 @@ public class ArticleCommentController {
     }
 
     @PostMapping("/complete-read")
-    public Result<Map<String, Object>> completeRead(@RequestBody Map<String, Object> params, @RequestAttribute("userId") Long userId) {
+    public Result<Map<String, Object>> completeRead(@RequestBody Map<String, Object> params, @RequestAttribute("userId") Long userId,
+                                                    @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long articleId = Long.valueOf(params.get("articleId").toString());
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         int earned = 5;
-        if (childId != null) try { energyService.awardEnergy(childId, "article", articleId, earned, "完成阅读", null); } catch (Exception e) {}
+        if (memberId != null) try { energyService.awardEnergy(memberId, "article", articleId, earned, "完成阅读", null); } catch (Exception e) {}
         Map<String, Object> r = new HashMap<>();
         r.put("completed", true); r.put("energyEarned", earned); return Result.success(r);
     }
@@ -106,11 +107,12 @@ public class ArticleCommentController {
     }
 
     @PostMapping("/quiz/submit")
-    public Result<Map<String, Object>> submitQuiz(@RequestBody Map<String, Object> params, @RequestAttribute("userId") Long userId) {
+    public Result<Map<String, Object>> submitQuiz(@RequestBody Map<String, Object> params, @RequestAttribute("userId") Long userId,
+                                                  @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         int correct = params.get("correctCount") != null ? Integer.parseInt(params.get("correctCount").toString()) : 0;
         int earned = correct * 5;
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId != null && earned > 0) try { energyService.awardEnergy(childId, "article_quiz", 0L, earned, "答题奖励", null); } catch (Exception e) {}
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId != null && earned > 0) try { energyService.awardEnergy(memberId, "article_quiz", 0L, earned, "答题奖励", null); } catch (Exception e) {}
         Map<String, Object> r = new HashMap<>();
         r.put("correctCount", correct); r.put("totalQuestions", 3); r.put("earnedEnergy", earned);
         return Result.success(r);

+ 26 - 21
cfc-backend/src/main/java/com/etotem/cfc/controller/content/ArticleController.java

@@ -101,39 +101,42 @@ public class ArticleController {
 
     @PostMapping("/record-read")
     public Result<Map<String, Object>> recordRead(@RequestBody Map<String, Object> body,
-                                      @RequestAttribute(value = "userId", required = false) Long userId) {
+                                      @RequestAttribute(value = "userId", required = false) Long userId,
+                                      @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long articleId = Long.valueOf(body.get("id").toString());
         int durationSeconds = body.get("durationSeconds") != null
                 ? Integer.parseInt(body.get("durationSeconds").toString()) : 0;
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString()) : null;
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
 
-        Map<String, Object> readResult = articleService.recordRead(articleId, userId, childId, durationSeconds);
+        Map<String, Object> readResult = articleService.recordRead(articleId, userId, memberId, durationSeconds);
         return Result.success(readResult);
     }
 
     @PostMapping("/report-reading-time")
     public Result<Void> reportReadingTime(@RequestBody Map<String, Object> body,
-                                           @RequestAttribute(value = "userId", required = false) Long userId) {
+                                           @RequestAttribute(value = "userId", required = false) Long userId,
+                                           @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long articleId = Long.valueOf(body.get("articleId").toString());
         int durationSeconds = body.get("durationSeconds") != null
                 ? Integer.parseInt(body.get("durationSeconds").toString()) : 0;
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString()) : null;
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
 
-        articleService.reportReadingTime(articleId, userId, childId, durationSeconds);
+        articleService.reportReadingTime(articleId, userId, memberId, durationSeconds);
         return Result.success(null);
     }
 
     @PostMapping("/reading-stats")
-    public Result<ReadingStatsDTO> readingStats(@RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+    public Result<ReadingStatsDTO> readingStats(@RequestBody Map<String, Object> body,
+                                                @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        ReadingStatsDTO stats = articleService.getReadingStats(childId);
+        ReadingStatsDTO stats = articleService.getReadingStats(memberId);
         return Result.success(stats);
     }
 
@@ -145,11 +148,12 @@ public class ArticleController {
 
     @PostMapping("/ai-questions")
     public Result<Map<String, Object>> aiQuestions(@RequestBody Map<String, Object> body,
-                                                    @RequestAttribute("userId") Long userId) {
+                                                    @RequestAttribute("userId") Long userId,
+                                                    @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long articleId = Long.valueOf(body.get("articleId").toString());
-        Long childId = body.get("childId") != null ? Long.valueOf(body.get("childId").toString()) : null;
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         try {
-            Map<String, Object> data = articleService.getAiQuestions(articleId, userId, childId);
+            Map<String, Object> data = articleService.getAiQuestions(articleId, userId, memberId);
             return Result.success(data);
         } catch (RuntimeException e) {
             return Result.error(e.getMessage());
@@ -158,12 +162,13 @@ public class ArticleController {
 
     @PostMapping("/submit-answers")
     public Result<Map<String, Object>> submitAnswers(@RequestBody Map<String, Object> body,
-                                                      @RequestAttribute("userId") Long userId) {
+                                                      @RequestAttribute("userId") Long userId,
+                                                      @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long recordId = Long.valueOf(body.get("recordId").toString());
         String answersJson = (String) body.get("answers");
-        Long childId = body.get("childId") != null ? Long.valueOf(body.get("childId").toString()) : null;
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         try {
-            Map<String, Object> data = articleService.submitAnswers(recordId, answersJson, userId, childId);
+            Map<String, Object> data = articleService.submitAnswers(recordId, answersJson, userId, memberId);
             return Result.success(data);
         } catch (RuntimeException e) {
             return Result.error(e.getMessage());

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/family/FamilyUserController.java

@@ -148,8 +148,8 @@ public class FamilyUserController {
     @PostMapping("/children/update")
     public Result<Boolean> updateFamilyMember(@RequestAttribute("userId") Long userId,
         @RequestBody UpdateFamilyMemberDTO dto) {
-        Long childId = dto.getFamilyMemberId();
-        boolean success = userService.updateFamilyMember(userId, childId, dto);
+        Long memberId = dto.getFamilyMemberId();
+        boolean success = userService.updateFamilyMember(userId, memberId, dto);
         return Result.success(success);
     }
 

+ 33 - 28
cfc-backend/src/main/java/com/etotem/cfc/controller/family/PointsController.java

@@ -17,52 +17,57 @@ public class PointsController {
     @Resource
     private PointsService pointsService;
 
-    @PostMapping("/balance")
-    public Result<Map<String, Object>> getBalance(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
-        Map<String, Object> balance = pointsService.getBalance(childId);
-        return Result.success(balance);
-    }
-
-    @PostMapping("/logs")
-    public Result<Page<PointsLog>> getPointsLogs(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
-        Integer page = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
-        Integer size = params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 10;
-        Page<PointsLog> logs = pointsService.getPointsLogs(childId, page, size);
-        return Result.success(logs);
-    }
-
+    @PostMapping("/balance")
+    public Result<Map<String, Object>> getBalance(@RequestBody Map<String, Object> params,
+                                                  @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        Map<String, Object> balance = pointsService.getBalance(memberId);
+        return Result.success(balance);
+    }
+
+    @PostMapping("/logs")
+    public Result<Page<PointsLog>> getPointsLogs(@RequestBody Map<String, Object> params,
+                                                 @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        Integer page = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
+        Integer size = params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 10;
+        Page<PointsLog> logs = pointsService.getPointsLogs(memberId, page, size);
+        return Result.success(logs);
+    }
+
     @PostMapping("/adjust")
     public Result<Map<String, Object>> adjustPoints(@RequestBody Map<String, Object> params,
-                                                    @RequestAttribute("userId") Long userId) {
-        Long childId = Long.valueOf(params.get("childId").toString());
+                                                    @RequestAttribute("userId") Long userId,
+                                                    @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         Integer amount = Integer.valueOf(params.get("amount").toString());
         String reason = params.get("reason").toString();
         String password = params.get("password").toString();
-        Map<String, Object> result = pointsService.adjustPoints(childId, amount, reason, password, userId);
+        Map<String, Object> result = pointsService.adjustPoints(memberId, amount, reason, password, userId);
         return Result.success(result);
     }
 
     @PostMapping("/system-balance")
-    public Result<Map<String, Object>> getSystemBalance(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+    public Result<Map<String, Object>> getSystemBalance(@RequestBody Map<String, Object> params,
+                                                        @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        int balance = pointsService.getSystemPointsBalance(childId);
+        int balance = pointsService.getSystemPointsBalance(memberId);
         Map<String, Object> result = new HashMap<>();
         result.put("systemPoints", balance);
         return Result.success(result);
     }
 
     @PostMapping("/logs-by-category")
-    public Result<Page<PointsLog>> getPointsLogsByCategory(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+    public Result<Page<PointsLog>> getPointsLogsByCategory(@RequestBody Map<String, Object> params,
+                                                          @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String category = params.get("category") != null ? params.get("category").toString() : null;
         Integer page = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
         Integer size = params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 10;
-        Page<PointsLog> logs = pointsService.getPointsLogsByCategory(childId, category, page, size);
+        Page<PointsLog> logs = pointsService.getPointsLogsByCategory(memberId, category, page, size);
         return Result.success(logs);
-    }
+    }
 }

+ 6 - 6
cfc-backend/src/main/java/com/etotem/cfc/controller/growth/GrowthPlanController.java

@@ -32,16 +32,16 @@ public class GrowthPlanController {
     }
 
     @Operation(summary = "获取孩子的成长方案列表")
-    @PostMapping("/child/{childId}")
-    public Result<List<GrowthPlan>> getChildPlans(@PathVariable Long childId) {
-        List<GrowthPlan> plans = growthPlanService.getByChildId(childId);
+    @PostMapping("/child/{memberId}")
+    public Result<List<GrowthPlan>> getChildPlans(@PathVariable Long memberId) {
+        List<GrowthPlan> plans = growthPlanService.getByChildId(memberId);
         return Result.success(plans);
     }
 
     @Operation(summary = "获取孩子当前活跃方案")
-    @PostMapping("/child/{childId}/active")
-    public Result<GrowthPlan> getActivePlan(@PathVariable Long childId) {
-        GrowthPlan plan = growthPlanService.getActivePlanByChildId(childId);
+    @PostMapping("/child/{memberId}/active")
+    public Result<GrowthPlan> getActivePlan(@PathVariable Long memberId) {
+        GrowthPlan plan = growthPlanService.getActivePlanByChildId(memberId);
         if (plan == null) {
             return Result.error("暂无活跃方案");
         }

+ 35 - 27
cfc-backend/src/main/java/com/etotem/cfc/controller/growth/GrowthRecordController.java

@@ -59,10 +59,12 @@ public class GrowthRecordController {
     @PostMapping("/record/create-with-order")
     public Result<Map<String, Object>> createRecordWithOrder(
             @RequestBody Map<String, Object> body,
-            @RequestAttribute("userId") Long userId) {
+            @RequestAttribute("userId") Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         GrowthRecord record = new GrowthRecord();
-        if (body.get("childId") != null) {
-            record.setChildId(Long.valueOf(body.get("childId").toString()));
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
+        if (memberId != null) {
+            record.setChildId(memberId);
         }
         if (body.get("school") != null) record.setSchool(body.get("school").toString());
         if (body.get("grade") != null) record.setGrade(Integer.valueOf(body.get("grade").toString()));
@@ -128,16 +130,18 @@ public class GrowthRecordController {
     }
 
     @Operation(summary = "获取指定孩子的成长档案列表")
-    @PostMapping("/record/child/{childId}")
-    public Result<List<GrowthRecord>> getChildRecords(@PathVariable Long childId) {
-        List<GrowthRecord> records = growthRecordService.getRecordsByChild(childId);
+    @PostMapping("/record/child/{memberId}")
+    public Result<List<GrowthRecord>> getChildRecords(@PathVariable Long memberId) {
+        List<GrowthRecord> records = growthRecordService.getRecordsByChild(memberId);
         return Result.success(records);
     }
 
     @Operation(summary = "获取孩子的成长档案列表")
     @PostMapping("/record/child-records")
-    public Result<List<GrowthRecord>> getRecordsByChild(@RequestBody Long childId) {
-        List<GrowthRecord> records = growthRecordService.getRecordsByChild(childId);
+    public Result<List<GrowthRecord>> getRecordsByChild(@RequestBody Long memberId,
+                                                        @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long effectiveMemberId = memberId != null ? memberId : currentMemberId;
+        List<GrowthRecord> records = growthRecordService.getRecordsByChild(effectiveMemberId);
         return Result.success(records);
     }
 
@@ -164,16 +168,17 @@ public class GrowthRecordController {
 
     @Operation(summary = "外部系统同步测评结果")
     @PostMapping("/external/sync")
-    public Result<GrowthRecord> syncExternalResult(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+    public Result<GrowthRecord> syncExternalResult(@RequestBody Map<String, Object> params,
+                                                   @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         Long parentId = params.get("parentId") != null ? Long.valueOf(params.get("parentId").toString()) : null;
         Long assessmentId = params.get("assessmentId") != null ? Long.valueOf(params.get("assessmentId").toString()) : null;
 
-        if (childId == null || parentId == null || assessmentId == null) {
-            return Result.error("缺少必要参数: childId, parentId, assessmentId");
+        if (memberId == null || parentId == null || assessmentId == null) {
+            return Result.error("缺少必要参数: memberId, parentId, assessmentId");
         }
 
-        GrowthRecord record = growthRecordService.syncExternalResult(childId, parentId, assessmentId);
+        GrowthRecord record = growthRecordService.syncExternalResult(memberId, parentId, assessmentId);
         if (record == null) {
             return Result.error("同步失败,测评结果不存在");
         }
@@ -215,9 +220,10 @@ public class GrowthRecordController {
     @Operation(summary = "上传解析后创建成长档案(Stage 2)")
     @PostMapping("/record/create-from-upload")
     public Result<GrowthRecord> createFromUpload(@RequestBody Map<String, Object> body,
-                                                  @RequestAttribute("userId") Long userId) {
-        Long childId = body.get("childId") != null ? Long.valueOf(body.get("childId").toString()) : null;
-        if (childId == null) {
+                                                  @RequestAttribute("userId") Long userId,
+                                                  @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
+        if (memberId == null) {
             return Result.error("请选择孩子");
         }
         String sourceFileUrl = body.get("sourceFileUrl") != null ? body.get("sourceFileUrl").toString() : null;
@@ -239,19 +245,20 @@ public class GrowthRecordController {
         }
 
         GrowthRecord record = growthRecordService.createFromUpload(
-                childId, userId, parsed, sourceFileUrl, manualReportDate);
+                memberId, userId, parsed, sourceFileUrl, manualReportDate);
         return Result.success(record);
     }
 
     @Operation(summary = "创建补充记录(补充材料)")
     @PostMapping("/record/supplement")
     public Result<GrowthRecord> createSupplement(@RequestBody Map<String, Object> body,
-                                                  @RequestAttribute("userId") Long userId) {
+                                                  @RequestAttribute("userId") Long userId,
+                                                  @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         Long parentRecordId = body.get("parentRecordId") != null
                 ? Long.valueOf(body.get("parentRecordId").toString()) : null;
-        Long childId = body.get("childId") != null ? Long.valueOf(body.get("childId").toString()) : null;
-        if (parentRecordId == null || childId == null) {
-            return Result.error("缺少必要参数: parentRecordId, childId");
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
+        if (parentRecordId == null || memberId == null) {
+            return Result.error("缺少必要参数: parentRecordId, memberId");
         }
         String sourceFileUrl = body.get("sourceFileUrl") != null ? body.get("sourceFileUrl").toString() : null;
 
@@ -268,17 +275,18 @@ public class GrowthRecordController {
         }
 
         GrowthRecord record = growthRecordService.createSupplement(
-                parentRecordId, childId, userId, parsed, sourceFileUrl, reportDate);
+                parentRecordId, memberId, userId, parsed, sourceFileUrl, reportDate);
         return Result.success(record);
     }
 
     @Operation(summary = "检查是否已存在相同哈希的记录(去重)")
     @PostMapping("/record/check-duplicate")
-    public Result<Map<String, Object>> checkDuplicate(@RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null ? Long.valueOf(body.get("childId").toString()) : null;
+    public Result<Map<String, Object>> checkDuplicate(@RequestBody Map<String, Object> body,
+                                                      @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         String sourceType = body.get("sourceType") != null ? body.get("sourceType").toString() : "self_upload";
-        if (childId == null) {
-            return Result.error("缺少 childId");
+        if (memberId == null) {
+            return Result.error("缺少 memberId");
         }
         Date reportDate = null;
         if (body.get("reportDate") != null) {
@@ -290,7 +298,7 @@ public class GrowthRecordController {
             }
         }
 
-        GrowthRecord existing = growthRecordService.checkDuplicate(childId, reportDate, sourceType);
+        GrowthRecord existing = growthRecordService.checkDuplicate(memberId, reportDate, sourceType);
         Map<String, Object> result = new HashMap<>();
         result.put("duplicate", existing != null);
         if (existing != null) {

+ 7 - 7
cfc-backend/src/main/java/com/etotem/cfc/controller/guide/GuideFamilyTaskController.java

@@ -139,7 +139,7 @@ public class GuideFamilyTaskController {
 
         for (FamilyMember child : children) {
             Map<String, Object> childInfo = new HashMap<>();
-            childInfo.put("childId", child.getId());
+            childInfo.put("memberId", child.getId());
             childInfo.put("childName", child.getNickname());
             childInfo.put("totalPoints", child.getTotalPoints());
             childInfo.put("streakDays", child.getStreakDays());
@@ -188,10 +188,10 @@ public class GuideFamilyTaskController {
         @ApiResponse(responseCode = "403", description = "Access denied"),
         @ApiResponse(responseCode = "401", description = "未登录")
     })
-    @PostMapping("/{familyId}/children/{childId}/tasks")
+    @PostMapping("/{familyId}/children/{memberId}/tasks")
     public Result<Page<Task>> getFamilyMemberTasks(
             @PathVariable Long familyId,
-            @PathVariable Long childId,
+            @PathVariable Long memberId,
             @RequestAttribute("role") String role,
             @RequestBody(required = false) Map<String, Object> params) {
         if (!"teacher".equals(role)) { return Result.error("Access denied"); }
@@ -200,7 +200,7 @@ public class GuideFamilyTaskController {
         Integer size = params != null && params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 10;
         String status = params != null && params.get("status") != null ? params.get("status").toString() : null;
 
-        Page<Task> tasks = taskService.getTaskHistoryByFamilyMember(childId, page, size, status);
+        Page<Task> tasks = taskService.getTaskHistoryByFamilyMember(memberId, page, size, status);
         return Result.success(tasks);
     }
 
@@ -213,14 +213,14 @@ public class GuideFamilyTaskController {
         @ApiResponse(responseCode = "403", description = "Access denied"),
         @ApiResponse(responseCode = "401", description = "未登录")
     })
-    @PostMapping("/{familyId}/children/{childId}/pending-review")
+    @PostMapping("/{familyId}/children/{memberId}/pending-review")
     public Result<List<Task>> getPendingReviewTasks(
             @PathVariable Long familyId,
-            @PathVariable Long childId,
+            @PathVariable Long memberId,
             @RequestAttribute("role") String role) {
 
         if (!"teacher".equals(role)) { return Result.error("Access denied"); }
-        List<Task> tasks = taskService.getPendingReviewTasksForFamilyMember(childId);
+        List<Task> tasks = taskService.getPendingReviewTasksForFamilyMember(memberId);
         return Result.success(tasks);
     }
 

+ 23 - 20
cfc-backend/src/main/java/com/etotem/cfc/controller/guide/TrainingPlanController.java

@@ -23,13 +23,14 @@ public class TrainingPlanController {
     @Operation(summary = "获取规划师的所有训练方案列表")
     @PostMapping("/list")
     public Result<List<TrainingPlan>> getPlanList(@RequestAttribute("userId") Long guideId,
-            @RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
+            @RequestBody Map<String, Object> body,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
         List<TrainingPlan> plans;
-        if (childId != null) {
-            plans = trainingPlanService.getPlansByGuideAndChild(guideId, childId);
+        if (memberId != null) {
+            plans = trainingPlanService.getPlansByGuideAndChild(guideId, memberId);
         } else {
             plans = trainingPlanService.getPlansByGuide(guideId);
         }
@@ -59,16 +60,17 @@ public class TrainingPlanController {
     @Operation(summary = "创建空白训练方案")
     @PostMapping("/create")
     public Result<Long> createPlan(@RequestAttribute("userId") Long guideId,
-            @RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
+            @RequestBody Map<String, Object> body,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
         String title = body.get("title") != null ? body.get("title").toString() : null;
         String description = body.get("description") != null ? body.get("description").toString() : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        Long planId = trainingPlanService.createPlan(guideId, childId, title, description, "manual");
+        Long planId = trainingPlanService.createPlan(guideId, memberId, title, description, "manual");
         return Result.success(planId);
     }
 
@@ -123,14 +125,15 @@ public class TrainingPlanController {
     @Operation(summary = "从推荐结果生成训练方案")
     @PostMapping("/generate-from-recommendations")
     public Result<Long> generateFromRecommendations(@RequestAttribute("userId") Long guideId,
-            @RequestBody Map<String, Object> body) {
-        Long childId = body.get("childId") != null
-                ? Long.valueOf(body.get("childId").toString())
-                : null;
-        if (childId == null) {
-            return Result.error("childId不能为空");
+            @RequestBody Map<String, Object> body,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null
+                ? Long.valueOf(body.get("memberId").toString())
+                : currentMemberId;
+        if (memberId == null) {
+            return Result.error("memberId不能为空");
         }
-        Long planId = trainingPlanService.generateFromRecommendations(guideId, childId);
+        Long planId = trainingPlanService.generateFromRecommendations(guideId, memberId);
         if (planId == null) {
             return Result.error("生成失败,请确认该孩子已完成认知评估");
         }

+ 14 - 12
cfc-backend/src/main/java/com/etotem/cfc/controller/mind/EmotionAlertController.java

@@ -45,13 +45,14 @@ public class EmotionAlertController {
      * 获取活跃告警列表
      */
     @PostMapping("/active")
-    public Result<?> active(@RequestBody Map<String, Object> params) {
-        Object childIdObj = params.get("childId");
-        if (childIdObj == null) {
-            return Result.error("参数缺失:childId");
+    public Result<?> active(@RequestBody Map<String, Object> params,
+                            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Object memberIdObj = params.get("memberId");
+        Long memberId = memberIdObj != null ? Long.valueOf(memberIdObj.toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("参数缺失:memberId");
         }
-        Long childId = Long.valueOf(childIdObj.toString());
-        List<EmotionAlertVO> alerts = mentalHealthScreenService.getActiveAlerts(childId);
+        List<EmotionAlertVO> alerts = mentalHealthScreenService.getActiveAlerts(memberId);
         return Result.success(alerts);
     }
 
@@ -59,13 +60,14 @@ public class EmotionAlertController {
      * 获取情绪风险告警(从打卡自动检测)
      */
     @PostMapping("/checkin-alerts")
-    public Result<?> checkinAlerts(@RequestBody Map<String, Object> params) {
-        Object childIdObj = params.get("childId");
-        if (childIdObj == null) {
-            return Result.error("参数缺失:childId");
+    public Result<?> checkinAlerts(@RequestBody Map<String, Object> params,
+                                   @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Object memberIdObj = params.get("memberId");
+        Long memberId = memberIdObj != null ? Long.valueOf(memberIdObj.toString()) : currentMemberId;
+        if (memberId == null) {
+            return Result.error("参数缺失:memberId");
         }
-        Long childId = Long.valueOf(childIdObj.toString());
-        List<EmotionAlertVO> alerts = emotionAlertService.getActiveAlerts(childId);
+        List<EmotionAlertVO> alerts = emotionAlertService.getActiveAlerts(memberId);
         return Result.success(alerts);
     }
 

+ 20 - 15
cfc-backend/src/main/java/com/etotem/cfc/controller/mind/EmotionCheckinController.java

@@ -38,44 +38,49 @@ public class EmotionCheckinController {
     @PostMapping("/list")
     public Result<?> list(@RequestBody Map<String, Object> params,
                           @RequestAttribute("userId") Long userId,
-                          @RequestAttribute("role") String role) {
-        Long childId = Long.valueOf(params.get("childId").toString());
+                          @RequestAttribute("role") String role,
+                          @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         int page = params.containsKey("page") ? Integer.parseInt(params.get("page").toString()) : 1;
         int size = params.containsKey("size") ? Integer.parseInt(params.get("size").toString()) : 20;
         boolean hidePhoto = !"child".equals(role);
-        Object result = emotionCheckinService.getCheckinList(childId, page, size, userId, hidePhoto);
+        Object result = emotionCheckinService.getCheckinList(memberId, page, size, userId, hidePhoto);
         return Result.success(result);
     }
 
     @PostMapping("/latest")
     public Result<?> latest(@RequestBody Map<String, Object> params,
                             @RequestAttribute("userId") Long userId,
-                            @RequestAttribute("role") String role) {
-        Long childId = Long.valueOf(params.get("childId").toString());
+                            @RequestAttribute("role") String role,
+                            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         boolean hidePhoto = !"child".equals(role);
-        Object result = emotionCheckinService.getLatestCheckin(childId, userId, hidePhoto);
+        Object result = emotionCheckinService.getLatestCheckin(memberId, userId, hidePhoto);
         return Result.success(result);
     }
 
     @PostMapping("/trend")
-    public Result<?> trend(@RequestBody Map<String, Object> params) {
-        Long childId = Long.valueOf(params.get("childId").toString());
+    public Result<?> trend(@RequestBody Map<String, Object> params,
+                           @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String period = params.containsKey("period") ? params.get("period").toString() : "week";
-        EmotionTrendVO result = emotionCheckinService.getTrend(childId, period);
+        EmotionTrendVO result = emotionCheckinService.getTrend(memberId, period);
         return Result.success(result);
     }
 
     @PostMapping("/stats")
-    public Result<?> stats(@RequestBody Map<String, Object> params) {
-        Long childId = Long.valueOf(params.get("childId").toString());
-        EmotionStatsVO result = emotionCheckinService.getStats(childId);
+    public Result<?> stats(@RequestBody Map<String, Object> params,
+                           @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        EmotionStatsVO result = emotionCheckinService.getStats(memberId);
         return Result.success(result);
     }
 
     @PostMapping("/weekly-report")
-    public Result<?> weeklyReport(@RequestBody Map<String, Object> params) {
-        Long childId = Long.valueOf(params.get("childId").toString());
-        Object result = emotionCheckinService.getWeeklyReport(childId);
+    public Result<?> weeklyReport(@RequestBody Map<String, Object> params,
+                                  @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        Object result = emotionCheckinService.getWeeklyReport(memberId);
         return Result.success(result);
     }
 }

+ 13 - 9
cfc-backend/src/main/java/com/etotem/cfc/controller/mind/MindController.java

@@ -6,6 +6,7 @@ import com.etotem.cfc.service.EmiReportService;
 import com.etotem.cfc.service.HealthReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -30,10 +31,11 @@ public class MindController {
      * Returns indicators categorized as "神经递质与激素" and "短链脂肪酸".
      */
     @PostMapping("/neurotransmitters")
-    public Result<?> neurotransmitters(@RequestBody Map<String, Object> params) {
+    public Result<?> neurotransmitters(@RequestBody Map<String, Object> params,
+                                       @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         try {
-            Long childId = Long.valueOf(params.get("childId").toString());
-            Object result = healthReportService.getMindRelatedIndicators(childId);
+            Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+            Object result = healthReportService.getMindRelatedIndicators(memberId);
             return Result.success(result);
         } catch (Exception e) {
             log.error("获取神经递质指标失败", e);
@@ -45,10 +47,11 @@ public class MindController {
      * Get gut-emotion insight summary based on gut microbiome data.
      */
     @PostMapping("/gut-emotion-insight")
-    public Result<?> gutEmotionInsight(@RequestBody Map<String, Object> params) {
+    public Result<?> gutEmotionInsight(@RequestBody Map<String, Object> params,
+                                       @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         try {
-            Long childId = Long.valueOf(params.get("childId").toString());
-            Map<String, Object> result = healthReportService.getGutEmotionInsight(childId);
+            Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+            Map<String, Object> result = healthReportService.getGutEmotionInsight(memberId);
             return Result.success(result);
         } catch (Exception e) {
             log.error("获取肠脑情绪洞察失败", e);
@@ -62,10 +65,11 @@ public class MindController {
      * Get the latest EMI report for a child.
      */
     @PostMapping("/emireport/latest")
-    public Result<?> emiReportLatest(@RequestBody Map<String, Object> params) {
+    public Result<?> emiReportLatest(@RequestBody Map<String, Object> params,
+                                     @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
         try {
-            Long childId = Long.valueOf(params.get("childId").toString());
-            EmiReportDTO result = emiReportService.getChildLatestEmiReport(childId);
+            Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+            EmiReportDTO result = emiReportService.getChildLatestEmiReport(memberId);
             if (result == null) {
                 return Result.success(new java.util.HashMap<>());
             }

+ 8 - 6
cfc-backend/src/main/java/com/etotem/cfc/controller/mind/ScreeningController.java

@@ -42,11 +42,12 @@ public class ScreeningController {
      * 获取筛查历史
      */
     @PostMapping("/history")
-    public Result<?> history(@RequestBody Map<String, Object> params) {
-        Long childId = Long.valueOf(params.get("childId").toString());
+    public Result<?> history(@RequestBody Map<String, Object> params,
+                             @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String screenType = params.containsKey("screenType") ? params.get("screenType").toString() : null;
         int limit = params.containsKey("limit") ? Integer.parseInt(params.get("limit").toString()) : 10;
-        List<ScreenResultVO> list = mentalHealthScreenService.getScreenHistory(childId, screenType, limit);
+        List<ScreenResultVO> list = mentalHealthScreenService.getScreenHistory(memberId, screenType, limit);
         return Result.success(list);
     }
 
@@ -54,10 +55,11 @@ public class ScreeningController {
      * 获取最新一次筛查结果
      */
     @PostMapping("/latest")
-    public Result<?> latest(@RequestBody Map<String, Object> params) {
-        Long childId = Long.valueOf(params.get("childId").toString());
+    public Result<?> latest(@RequestBody Map<String, Object> params,
+                            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String screenType = params.containsKey("screenType") ? params.get("screenType").toString() : null;
-        ScreenResultVO result = mentalHealthScreenService.getLatestScreen(childId, screenType);
+        ScreenResultVO result = mentalHealthScreenService.getLatestScreen(memberId, screenType);
         return Result.success(result);
     }
 }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/parent/ParentAssessmentController.java

@@ -100,8 +100,8 @@ public class ParentAssessmentController {
             return Result.error("暂无可用测评资料");
         }
 
-        Long childId = getFamilyMemberIdByUserId(userId);
-        AssessmentRecord record = assessmentService.createRecord(familyId, childId, material.getId());
+        Long memberId = getFamilyMemberIdByUserId(userId);
+        AssessmentRecord record = assessmentService.createRecord(familyId, memberId, material.getId());
 
         return Result.success(record);
     }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/product/ProductOrderController.java

@@ -170,8 +170,8 @@ private QrCodeService qrCodeService;
     @PostMapping("/activity/sign-in")
     public Result<String> activitySignIn(@RequestBody Map<String, Object> params) {
         Long orderId = Long.valueOf(params.get("orderId").toString());
-        Long childId = Long.valueOf(params.get("childId").toString());
-        return activityProvisionService.signIn(orderId, childId);
+        Long memberId = Long.valueOf(params.get("memberId").toString());
+        return activityProvisionService.signIn(orderId, memberId);
     }
 
     @PostMapping("/activity/complete")

+ 15 - 12
cfc-backend/src/main/java/com/etotem/cfc/controller/reward/RewardController.java

@@ -27,18 +27,20 @@ public class RewardController {
     }
 
     @PostMapping("/wishlist")
-    public Result<List<RewardDTO>> getWishlist(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null ? ((Number) params.get("childId")).longValue() : null;
-        List<RewardDTO> wishlist = rewardService.getWishlist(childId);
+    public Result<List<RewardDTO>> getWishlist(@RequestBody Map<String, Object> params,
+                                               @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? ((Number) params.get("memberId")).longValue() : currentMemberId;
+        List<RewardDTO> wishlist = rewardService.getWishlist(memberId);
         return Result.success(wishlist);
     }
 
-    @PostMapping("/{id}/exchange")
-    public Result<Map<String, Object>> exchangeReward(@PathVariable Long id,
-                                                     @RequestBody Map<String, Object> params) {
-        Long childId = Long.valueOf(params.get("childId").toString());
-        Map<String, Object> result = rewardService.exchangeReward(id, childId);
-        return Result.success(result);
+    @PostMapping("/{id}/exchange")
+    public Result<Map<String, Object>> exchangeReward(@PathVariable Long id,
+                                                     @RequestBody Map<String, Object> params,
+                                                     @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        Map<String, Object> result = rewardService.exchangeReward(id, memberId);
+        return Result.success(result);
     }
 
     @PostMapping("/{id}/approve")
@@ -56,11 +58,12 @@ public class RewardController {
     }
 
     @PostMapping("/exchange-history")
-    public Result<Page<Reward>> getExchangeHistory(@RequestBody Map<String, Object> params) {
-        Long childId = params.get("childId") != null ? ((Number) params.get("childId")).longValue() : null;
+    public Result<Page<Reward>> getExchangeHistory(@RequestBody Map<String, Object> params,
+                                                   @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? ((Number) params.get("memberId")).longValue() : currentMemberId;
         Integer page = params.get("page") != null ? (Integer) params.get("page") : 1;
         Integer size = params.get("size") != null ? (Integer) params.get("size") : 10;
-        Page<Reward> history = rewardService.getExchangeHistory(childId, page, size);
+        Page<Reward> history = rewardService.getExchangeHistory(memberId, page, size);
         return Result.success(history);
     }
 }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/stats/StatsController.java

@@ -125,11 +125,11 @@ public class StatsController {
         User user = userMapper.selectById(userId);
         if (user == null) return Result.error("用户不存在");
 
-        Long childId = params.get("childId") != null ? Long.valueOf(params.get("childId").toString()) : null;
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : null;
         Date startDate = parseDate(params.get("startDate"));
         Date endDate = parseDate(params.get("endDate"));
 
-        Map<String, Object> stats = taskStatsService.getChildStats(childId, startDate, endDate);
+        Map<String, Object> stats = taskStatsService.getChildStats(memberId, startDate, endDate);
         return Result.success(stats);
     }
 

+ 23 - 19
cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskController.java

@@ -45,26 +45,28 @@ public class TaskController {
 
     @Operation(summary = "获取今日任务")
     @PostMapping("/today")
-    public Result<List<Task>> getTodayTasks(@RequestBody Map<String, Object> params) {
-        Long childId = Long.valueOf(params.get("childId").toString());
+    public Result<List<Task>> getTodayTasks(@RequestBody Map<String, Object> params,
+                                            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String category = params.get("category") != null ? params.get("category").toString() : null;
         String dimensionCode = params.get("dimensionCode") != null ? params.get("dimensionCode").toString() : null;
         List<Task> tasks;
         if (category != null && !category.isEmpty()) {
-            tasks = taskService.getTodayTasksByCategory(childId, category);
+            tasks = taskService.getTodayTasksByCategory(memberId, category);
         } else {
-            tasks = taskService.getTodayTasks(childId, dimensionCode);
+            tasks = taskService.getTodayTasks(memberId, dimensionCode);
         }
         return Result.success(tasks);
-    }
+    }
 
-    @Operation(summary = "完成任务")
-    @PostMapping("/{id}/complete")
-    public Result<Map<String, Object>> completeTask(@PathVariable Long id,
-                                                    @RequestBody CompleteTaskDTO dto) {
-        Long childId = dto.getChildId();
-        Map<String, Object> result = taskService.completeTask(id, childId, dto.getPhotoUrl());
-        return Result.success(result);
+    @Operation(summary = "完成任务")
+    @PostMapping("/{id}/complete")
+    public Result<Map<String, Object>> completeTask(@PathVariable Long id,
+                                                    @RequestBody CompleteTaskDTO dto,
+                                                    @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = dto.getMemberId() != null ? dto.getMemberId() : currentMemberId;
+        Map<String, Object> result = taskService.completeTask(id, memberId, dto.getPhotoUrl());
+        return Result.success(result);
     }
 
     @Operation(summary = "审核任务")
@@ -77,16 +79,17 @@ public class TaskController {
 
   @Operation(summary = "获取任务历史")
   @PostMapping("/history")
-  public Result<Page<Task>> getTaskHistory(@RequestBody Map<String, Object> params) {
-    Long childId = Long.valueOf(params.get("childId").toString());
+  public Result<Page<Task>> getTaskHistory(@RequestBody Map<String, Object> params,
+                                           @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+    Long memberId = params.get("memberId") != null ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
     Integer page = params.get("page") != null ? Integer.valueOf(params.get("page").toString()) : 1;
     Integer size = params.get("size") != null ? Integer.valueOf(params.get("size").toString()) : 10;
     String category = params.get("category") != null ? params.get("category").toString() : null;
     Page<Task> history;
     if (category != null && !category.isEmpty()) {
-        history = taskService.getTaskHistoryByCategory(childId, page, size, category);
+        history = taskService.getTaskHistoryByCategory(memberId, page, size, category);
     } else {
-        history = taskService.getTaskHistory(childId, page, size);
+        history = taskService.getTaskHistory(memberId, page, size);
     }
     return Result.success(history);
   }
@@ -125,15 +128,16 @@ public class TaskController {
     @PostMapping("/{id}/complete-minigame")
     public Result<Map<String, Object>> completeMinigameTask(
             @PathVariable Long id,
-            @RequestBody Map<String, Object> body) {
-        Long childId = Long.valueOf(body.get("childId").toString());
+            @RequestBody Map<String, Object> body,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = body.get("memberId") != null ? Long.valueOf(body.get("memberId").toString()) : currentMemberId;
         Integer completionTime = body.get("completionTime") != null ?
             Integer.valueOf(body.get("completionTime").toString()) : null;
         Integer score = body.get("score") != null ?
             Integer.valueOf(body.get("score").toString()) : null;
 
         try {
-            Map<String, Object> result = taskService.completeMinigameTask(id, childId, completionTime, score);
+            Map<String, Object> result = taskService.completeMinigameTask(id, memberId, completionTime, score);
             return Result.success(result);
         } catch (Exception e) {
             return Result.error(e.getMessage());

+ 21 - 21
cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskReminderController.java

@@ -28,9 +28,9 @@ public class TaskReminderController {
      * TASK-013: 获取需要提醒的任务(30分钟内到期)
      */
     @Operation(summary = "获取需要提醒的任务")
-    @PostMapping("/reminder/{childId}")
-    public Result<List<Task>> getTasksNeedReminder(@PathVariable Long childId) {
-        List<Task> tasks = taskReminderService.getTasksNeedReminder(childId);
+    @PostMapping("/reminder/{memberId}")
+    public Result<List<Task>> getTasksNeedReminder(@PathVariable Long memberId) {
+        List<Task> tasks = taskReminderService.getTasksNeedReminder(memberId);
         return Result.success(tasks);
     }
 
@@ -38,11 +38,11 @@ public class TaskReminderController {
      * TASK-013: 获取即将到期的任务(可指定时间范围)
      */
     @Operation(summary = "获取即将到期的任务")
-    @PostMapping("/upcoming/{childId}")
-    public Result<List<Task>> getUpcomingTasks(@PathVariable Long childId,
+    @PostMapping("/upcoming/{memberId}")
+    public Result<List<Task>> getUpcomingTasks(@PathVariable Long memberId,
                                                 @RequestBody(required = false) Map<String, Object> params) {
         Integer minutes = params != null && params.get("minutes") != null ? Integer.valueOf(params.get("minutes").toString()) : 60;
-        List<Task> tasks = taskReminderService.getUpcomingTasks(childId, minutes);
+        List<Task> tasks = taskReminderService.getUpcomingTasks(memberId, minutes);
         return Result.success(tasks);
     }
 
@@ -50,9 +50,9 @@ public class TaskReminderController {
      * TASK-013: 获取已超时任务
      */
     @Operation(summary = "获取已超时任务")
-    @PostMapping("/overdue/{childId}")
-    public Result<List<Task>> getOverdueTasks(@PathVariable Long childId) {
-        List<Task> tasks = taskReminderService.getOverdueTasks(childId);
+    @PostMapping("/overdue/{memberId}")
+    public Result<List<Task>> getOverdueTasks(@PathVariable Long memberId) {
+        List<Task> tasks = taskReminderService.getOverdueTasks(memberId);
         return Result.success(tasks);
     }
 
@@ -60,9 +60,9 @@ public class TaskReminderController {
      * TASK-014: 获取任务历史(带筛选)
      */
     @Operation(summary = "获取任务历史(带筛选)")
-    @PostMapping("/history/filter/{childId}")
+    @PostMapping("/history/filter/{memberId}")
     public Result<Map<String, Object>> getTaskHistoryWithFilter(
-            @PathVariable Long childId,
+            @PathVariable Long memberId,
             @RequestBody(required = false) Map<String, Object> params) {
         String status = params != null && params.get("status") != null ? params.get("status").toString() : null;
         Date startDate = null;
@@ -81,7 +81,7 @@ public class TaskReminderController {
             endDate = null;
         }
         Map<String, Object> result = taskReminderService.getTaskHistoryWithFilter(
-            childId, status, startDate, endDate, page, size);
+            memberId, status, startDate, endDate, page, size);
         return Result.success(result);
     }
 
@@ -89,9 +89,9 @@ public class TaskReminderController {
      * TASK-015: 获取任务统计概览
      */
     @Operation(summary = "获取任务统计概览")
-    @PostMapping("/statistics/{childId}")
+    @PostMapping("/statistics/{memberId}")
     public Result<Map<String, Object>> getTaskStatistics(
-            @PathVariable Long childId,
+            @PathVariable Long memberId,
             @RequestBody(required = false) Map<String, Object> params) {
         Date startDate = null;
         Date endDate = null;
@@ -106,7 +106,7 @@ public class TaskReminderController {
             startDate = null;
             endDate = null;
         }
-        Map<String, Object> stats = taskReminderService.getTaskStatistics(childId, startDate, endDate);
+        Map<String, Object> stats = taskReminderService.getTaskStatistics(memberId, startDate, endDate);
         return Result.success(stats);
     }
 
@@ -114,9 +114,9 @@ public class TaskReminderController {
      * TASK-015: 获取按分类统计
      */
     @Operation(summary = "获取按分类统计")
-    @PostMapping("/statistics/category/{childId}")
-    public Result<List<Map<String, Object>>> getTaskStatsByCategory(@PathVariable Long childId) {
-        List<Map<String, Object>> stats = taskReminderService.getTaskStatsByCategory(childId);
+    @PostMapping("/statistics/category/{memberId}")
+    public Result<List<Map<String, Object>>> getTaskStatsByCategory(@PathVariable Long memberId) {
+        List<Map<String, Object>> stats = taskReminderService.getTaskStatsByCategory(memberId);
         return Result.success(stats);
     }
 
@@ -124,12 +124,12 @@ public class TaskReminderController {
      * TASK-015: 获取按日期统计
      */
     @Operation(summary = "获取按日期统计")
-    @PostMapping("/statistics/date/{childId}")
+    @PostMapping("/statistics/date/{memberId}")
     public Result<List<Map<String, Object>>> getTaskStatsByDate(
-            @PathVariable Long childId,
+            @PathVariable Long memberId,
             @RequestBody(required = false) Map<String, Object> params) {
         Integer days = params != null && params.get("days") != null ? Integer.valueOf(params.get("days").toString()) : 7;
-        List<Map<String, Object>> stats = taskReminderService.getTaskStatsByDate(childId, days);
+        List<Map<String, Object>> stats = taskReminderService.getTaskStatsByDate(memberId, days);
         return Result.success(stats);
     }
 

+ 10 - 8
cfc-backend/src/main/java/com/etotem/cfc/controller/wealth/FinanceCheckinController.java

@@ -27,11 +27,12 @@ public class FinanceCheckinController {
     @PostMapping("/list")
     public Result<List<FinanceCheckin>> list(
             @RequestBody Map<String, Object> params,
-            @RequestAttribute("userId") Long userId) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
+            @RequestAttribute(value = "userId", required = false) Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String yearMonth = (String) params.get("yearMonth");
-        List<FinanceCheckin> list = financeCheckinService.getCheckins(userId, childId, yearMonth);
+        List<FinanceCheckin> list = financeCheckinService.getCheckins(userId, memberId, yearMonth);
         return Result.success(list);
     }
 
@@ -39,10 +40,11 @@ public class FinanceCheckinController {
     @PostMapping("/stats")
     public Result<Map<String, Object>> stats(
             @RequestBody Map<String, Object> params,
-            @RequestAttribute(value = "userId", required = false) Long userId) {
-        Long childId = params.get("childId") != null
-                ? Long.valueOf(params.get("childId").toString()) : null;
-        Map<String, Object> stats = financeCheckinService.getCheckinStats(userId, childId);
+            @RequestAttribute(value = "userId", required = false) Long userId,
+            @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+                ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
+        Map<String, Object> stats = financeCheckinService.getCheckinStats(userId, memberId);
         return Result.success(stats);
     }
 

+ 12 - 12
cfc-backend/src/main/java/com/etotem/cfc/controller/wisdom/WisdomMathController.java

@@ -21,35 +21,35 @@ public class WisdomMathController {
 
     @PostMapping("/start")
     public Result<Map<String, Object>> start(@RequestBody Map<String, Object> params,
-                                              @RequestAttribute("userId") Long userId) {
-        Long childId = params.get("childId") != null
-            ? Long.valueOf(params.get("childId").toString()) : userId;
+                                              @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+            ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         Integer age = params.get("age") != null
             ? Integer.valueOf(params.get("age").toString()) : null;
-        return Result.success(wisdomMathService.startSession(childId, age));
+        return Result.success(wisdomMathService.startSession(memberId, age));
     }
 
     @PostMapping("/verify")
     public Result<Map<String, Object>> verify(@RequestBody Map<String, Object> params,
-                                               @RequestAttribute("userId") Long userId) {
-        Long childId = params.get("childId") != null
-            ? Long.valueOf(params.get("childId").toString()) : userId;
+                                               @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+            ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         String expression = params.get("expression") != null ? params.get("expression").toString() : "";
         String userAnswer = params.get("userAnswer") != null ? params.get("userAnswer").toString() : "";
-        return Result.success(wisdomMathService.verifyAnswer(childId, expression, userAnswer));
+        return Result.success(wisdomMathService.verifyAnswer(memberId, expression, userAnswer));
     }
 
     @PostMapping("/complete")
     public Result<Map<String, Object>> complete(@RequestBody Map<String, Object> params,
-                                                 @RequestAttribute("userId") Long userId) {
-        Long childId = params.get("childId") != null
-            ? Long.valueOf(params.get("childId").toString()) : userId;
+                                                 @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
+        Long memberId = params.get("memberId") != null
+            ? Long.valueOf(params.get("memberId").toString()) : currentMemberId;
         int level = params.get("level") != null ? Integer.parseInt(params.get("level").toString()) : 1;
         int targetN = params.get("targetN") != null ? Integer.parseInt(params.get("targetN").toString()) : 5;
         int correctCount = params.get("correctCount") != null ? Integer.parseInt(params.get("correctCount").toString()) : 0;
         int totalAttempts = params.get("totalAttempts") != null ? Integer.parseInt(params.get("totalAttempts").toString()) : 0;
         long totalTimeMs = params.get("totalTimeMs") != null ? Long.parseLong(params.get("totalTimeMs").toString()) : 0;
         List<String> expressions = params.get("expressions") != null ? (List<String>) params.get("expressions") : null;
-        return Result.success(wisdomMathService.completeSession(childId, level, targetN, correctCount, totalAttempts, totalTimeMs, expressions));
+        return Result.success(wisdomMathService.completeSession(memberId, level, targetN, correctCount, totalAttempts, totalTimeMs, expressions));
     }
 }

+ 4 - 4
cfc-backend/src/main/java/com/etotem/cfc/controller/wish/WishController.java

@@ -196,7 +196,7 @@ public class WishController {
     public Result<List<WishDTO>> getWishes(
             @RequestAttribute("userId") Long userId,
             @RequestAttribute("role") String role,
-            @RequestParam(required = false) Long childId,
+            @RequestParam(required = false) Long memberId,
             @RequestParam(required = false) Long familyId,
             @RequestParam(required = false) String status) {
         try {
@@ -204,14 +204,14 @@ public class WishController {
             if ("child".equals(role)) {
                 // 孩子只能看自己的心愿
                 wishes = wishService.getChildWishes(userId);
-            } else if (childId != null) {
+            } else if (memberId != null) {
                 // 家长查看指定孩子的心愿
-                wishes = wishService.getChildWishes(childId);
+                wishes = wishService.getChildWishes(memberId);
             } else if (familyId != null) {
                 // 家长查看家庭所有心愿
                 wishes = wishService.getFamilyWishes(familyId);
             } else {
-                return Result.error("请指定查询条件(childId或familyId)");
+                return Result.error("请指定查询条件(memberId或familyId)");
             }
             return Result.success(wishes);
         } catch (Exception e) {

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/AdjustPointsDTO.java

@@ -12,7 +12,7 @@ import javax.validation.constraints.NotNull;
 public class AdjustPointsDTO {
 
     @NotNull(message = "孩子ID不能为空")
-    private Long childId;
+    private Long memberId;
 
     @NotNull(message = "调整金额不能为空")
     private Integer amount;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/AdminAdjustPointsDTO.java

@@ -5,7 +5,7 @@ import lombok.Data;
 import javax.validation.constraints.NotNull;
 
 /**
- * 管理员调整孩子积分 DTO(路径含childId,故不含childId)
+ * 管理员调整孩子积�?DTO(路径含memberId,故不含memberId�?
  */
 @Data
 public class AdminAdjustPointsDTO {

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/ApplyAfterPaymentDTO.java

@@ -11,7 +11,7 @@ public class ApplyAfterPaymentDTO {
     private Long orderId;
 
     @NotNull(message = "孩子ID不能为空")
-    private Long childId;
+    private Long memberId;
 
     private List<Long> selectedItemIds;
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/ApplyPackageDTO.java

@@ -7,6 +7,6 @@ import java.util.List;
 @Data
 public class ApplyPackageDTO {
     private Long packageId;
-    private Long childId;
+    private Long memberId;
     private List<Long> selectedItemIds;  // 家长勾选的任务项ID
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentAppointmentDTO.java

@@ -8,7 +8,7 @@ public class AssessmentAppointmentDTO {
     private Long id;
     private Long teacherId;
     private Long familyId;
-    private Long childId;
+    private Long memberId;
     private String appointmentDate;
     private String appointmentTime;
     private Integer durationMinutes;

+ 3 - 3
cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentCreateAppointmentDTO.java

@@ -5,12 +5,12 @@ import lombok.Data;
 import javax.validation.constraints.Min;
 
 /**
- * 创建评估预约 DTO(家长端
+ * 创建评估预约 DTO(家长端�?
  */
 @Data
 public class AssessmentCreateAppointmentDTO {
 
-    private Long childId;
+    private Long memberId;
 
     private Long guideId;
 
@@ -28,6 +28,6 @@ public class AssessmentCreateAppointmentDTO {
 
     private String packageName;
 
-    @Min(value = 0, message = "优惠金额不能为负")
+    @Min(value = 0, message = "优惠金额不能为负")
     private Long discountAmount;
 }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentCreateOrderDTO.java

@@ -14,7 +14,7 @@ public class AssessmentCreateOrderDTO {
     @NotNull(message = "家庭ID不能为空")
     private Long familyId;
 
-    private Long childId;
+    private Long memberId;
 
     @NotNull(message = "规划师ID不能为空")
     private Long guideId;
@@ -28,6 +28,6 @@ public class AssessmentCreateOrderDTO {
 
     private Long totalPrice;
 
-    @Min(value = 0, message = "优惠金额不能为负")
+    @Min(value = 0, message = "优惠金额不能为负")
     private Long discountAmount;
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentQuotaVO.java

@@ -9,7 +9,7 @@ public class AssessmentQuotaVO {
     private Long id;
     private String quotaNo;
     private Long familyId;
-    private Long childId;
+    private Long memberId;
     private Long productOrderId;
     private Long productId;
     private String productName;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/AssessmentResultDTO.java

@@ -8,7 +8,7 @@ import java.util.Date;
 @Data
 public class AssessmentResultDTO implements Serializable {
 
-    private Long childId;
+    private Long memberId;
 
     private String childName;
 

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/dto/CognitiveRecommendationDTO.java

@@ -5,13 +5,13 @@ import lombok.Data;
 import java.util.List;
 
 /**
- * 认知推荐结果 — 包含各维度建议 + 综合建议
+ * 认知推荐结果 �?包含各维度建�?+ 综合建议
  */
 @Data
 public class CognitiveRecommendationDTO {
     private List<DimensionRecommendation> recommendations;
     private OverallRecommendation overall;
-    private Long childId;
+    private Long memberId;
     private String childName;
 
     @Data

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/CompleteGameDTO.java

@@ -8,7 +8,7 @@ import javax.validation.constraints.NotNull;
 @Data
 public class CompleteGameDTO {
     @NotNull(message = "孩子ID不能为空")
-    private Long childId;
+    private Long memberId;
 
     @NotBlank(message = "游戏代码不能为空")
     private String gameCode;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/CompleteTaskDTO.java

@@ -4,7 +4,7 @@ import lombok.Data;
 
 @Data
 public class CompleteTaskDTO {
-    private Long childId;
+    private Long memberId;
     private String photoUrl;
     private String voiceNoteUrl;
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/CreateAppointmentDTO.java

@@ -6,7 +6,7 @@ import lombok.Data;
 public class CreateAppointmentDTO {
     private Long teacherId;
     private Long familyId;
-    private Long childId;
+    private Long memberId;
     private String appointmentDate;
     private String appointmentTime;
     private Integer durationMinutes;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/CreateAssessmentResultDTO.java

@@ -5,7 +5,7 @@ import java.util.Date;
 
 @Data
 public class CreateAssessmentResultDTO {
-    private Long childId;
+    private Long memberId;
     private Long appointmentId;
     private Integer attentionScore;
     private Integer focusScore;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/CreateCognitiveTaskDTO.java

@@ -7,7 +7,7 @@ import lombok.Data;
  */
 @Data
 public class CreateCognitiveTaskDTO {
-    private Long childId;
+    private Long memberId;
     private String dimensionKey;
     private Integer taskIndex;       // 推荐列表中选第几个任务
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/CreateGrowthRecordDTO.java

@@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull;
 @Data
 public class CreateGrowthRecordDTO {
     @NotNull(message = "孩子ID不能为空")
-    private Long childId;
+    private Long memberId;
 
     private String recordTitle;
 

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/CreateRewardDTO.java

@@ -7,5 +7,5 @@ public class CreateRewardDTO {
     private String title;
     private Integer pointsRequired;
     private String category;
-    private Long childId;
+    private Long memberId;
 }

+ 13 - 13
cfc-backend/src/main/java/com/etotem/cfc/dto/CreateTaskDTO.java

@@ -6,39 +6,39 @@ import java.util.List;
 
 @Data
 public class CreateTaskDTO {
-    // 必填
+    // 必填�?
     private String title;
     private String description;
-    private String category;  // 类型:学习类/生活类/运动类/其他
+    private String category;  // 类型:学习类/生活�?运动�?其他
     private Integer points;   // 积分
     private Integer duration; // 时长(分钟)
-    private List<Long> childIds; // 完成的孩子(多选)
+    private List<Long> memberIds; // 完成的孩子(多选)
     
     // 任务性质
-    private String taskType;  // 一次性/循环 recurring
+    private String taskType;  // 一次�?循环 recurring
     private String frequency; // 频率:daily/weekly/monthly
-    private Integer maxFrequency; // 周期内最多完成次
+    private Integer maxFrequency; // 周期内最多完成次�?
     
     // 审核
-    private Integer needReview; // 是否需要审
+    private Integer needReview; // 是否需要审�?
     private String reviewType;  // 审核人类型:creator/parent/teacher/ai
-    private Integer reviewByCategory; // 按分类审
+    private Integer reviewByCategory; // 按分类审�?
     
     // 完成方式(多选)
     private List<String> completeTypes; // 打卡checkin/文本text/语音audio/图片image/视频video
     
-    // 非必
-    private Date earliestStart; // 最早开始时
-    private Date latestEnd;    // 最晚结束时
+    // 非必�?
+    private Date earliestStart; // 最早开始时�?
+    private Date latestEnd;    // 最晚结束时�?
     
-    // 执行者类型: child(孩子) 或 parent(家长)
+    // 执行者类�? child(孩子) �?parent(家长)
     private String executorType;
     // 执行者ID
     private Long executorId;
     // 兼容旧版 - 指定孩子ID
-    private Long childId;
+    private Long memberId;
 
-    // 小游戏代码(当category为'小游戏类'时必填): schulte/1a2b/sudoku
+    // 小游戏代码(当category�?小游戏类'时必填): schulte/1a2b/sudoku
     private String minigameCode;
 
     // 重复类型(兼容旧版)

+ 7 - 7
cfc-backend/src/main/java/com/etotem/cfc/dto/CreateWishDTO.java

@@ -10,19 +10,19 @@ public class CreateWishDTO {
     
     private String title;          // 心愿名称(必填)
 
-    private String description;    // 详细描述(选填
+    private String description;    // 详细描述(选填�?
 
-    private String category;       // 分类(选填
+    private String category;       // 分类(选填�?
 
-    private String imageUrl;       // 商品图片URL(选填
+    private String imageUrl;       // 商品图片URL(选填�?
 
-    private String linkUrl;        // 商品链接URL(选填
+    private String linkUrl;        // 商品链接URL(选填�?
 
     private Long estimatedPrice;   // 预估价格(选填),单位:分
 
-    private Long childId;          // 目标孩子ID(家长创建时必填)
+    private Long memberId;          // 目标孩子ID(家长创建时必填�?
 
-    private Integer pointsRequired; // 所需积分(家长创建时必填
+    private Integer pointsRequired; // 所需积分(家长创建时必填�?
 
     // Explicit setters (Lombok fallback)
     public void setTitle(String title) { this.title = title; }
@@ -31,6 +31,6 @@ public class CreateWishDTO {
     public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; }
     public void setLinkUrl(String linkUrl) { this.linkUrl = linkUrl; }
     public void setEstimatedPrice(Long estimatedPrice) { this.estimatedPrice = estimatedPrice; }
-    public void setChildId(Long childId) { this.childId = childId; }
+    public void setChildId(Long memberId) { this.memberId = memberId; }
     public void setPointsRequired(Integer pointsRequired) { this.pointsRequired = pointsRequired; }
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/DanAssessmentResultDTO.java

@@ -6,7 +6,7 @@ import java.util.Date;
 @Data
 public class DanAssessmentResultDTO {
     private Long id;
-    private Long childId;
+    private Long memberId;
     private Long teacherId;
     private Long appointmentId;
     private Integer attentionScore;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/EmiReportDTO.java

@@ -8,7 +8,7 @@ import java.util.Date;
 @Data
 public class EmiReportDTO implements Serializable {
 
-    private Long childId;
+    private Long memberId;
 
     private String childName;
 

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/EmotionAlertVO.java

@@ -8,7 +8,7 @@ import java.util.Date;
 @Data
 public class EmotionAlertVO implements Serializable {
     private Long id;
-    private Long childId;
+    private Long memberId;
     private String alertType;
     private String severity;
     private String title;

+ 5 - 5
cfc-backend/src/main/java/com/etotem/cfc/dto/EmotionCheckinDTO.java

@@ -6,17 +6,17 @@ import java.io.Serializable;
 
 @Data
 public class EmotionCheckinDTO implements Serializable {
-    private Long childId;
+    private Long memberId;
     private String moodWeather;          // 保留兼容(旧版天气字段)
-    private String emotionTags;           // 保留兼容(旧版标签 JSON)
+    private String emotionTags;           // 保留兼容(旧版标�?JSON�?
     private String photoUrl;
     private String note;
 
-    // === 情绪精细度字(Phase 1.1) ===
-    private Integer moodScore;            // 效价评分 1-10(1=极差, 10=极好)
+    // === 情绪精细度字�?(Phase 1.1) ===
+    private Integer moodScore;            // 效价评分 1-10�?=极差, 10=极好�?
     private String emotionType;           // 情绪大类: joy/sadness/anger/fear/disgust/surprise/trust/anticipation
     private Integer stressLevel;          // 压力水平 1-10
-    private Integer arousalLevel;         // 激活度 1-10(1=平静, 10=激动)
+    private Integer arousalLevel;         // 激活度 1-10�?=平静, 10=激动)
     private Integer energyLevel;          // 精力水平 1-10
 
     // === 睡眠字段 (Phase 3.1, 预埋) ===

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/dto/EmotionCheckinVO.java

@@ -8,7 +8,7 @@ import java.util.Date;
 @Data
 public class EmotionCheckinVO implements Serializable {
     private Long id;
-    private Long childId;
+    private Long memberId;
     private String childName;
     private String moodWeather;
     private String emotionTags;
@@ -18,7 +18,7 @@ public class EmotionCheckinVO implements Serializable {
     private Date checkinDate;
     private Date createdAt;
 
-    // === 情绪精细度字===
+    // === 情绪精细度字�?===
     private Integer moodScore;
     private String emotionType;
     private Integer stressLevel;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/ExecutionDetailResponse.java

@@ -9,7 +9,7 @@ import java.util.Date;
 public class ExecutionDetailResponse {
     private Long executionId;
     private Long assessmentOrderId;
-    private Long childId;
+    private Long memberId;
     private Long familyId;
     private Long quotaId;
 

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/GrowthPlanDTO.java

@@ -6,7 +6,7 @@ import java.util.Date;
 @Data
 public class GrowthPlanDTO {
     private Long id;
-    private Long childId;
+    private Long memberId;
     private Long teacherId;
     private Long assessmentId;
     private String planTitle;

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/dto/MinigameCompleteDTO.java

@@ -5,13 +5,13 @@ import lombok.Data;
 import javax.validation.constraints.NotNull;
 
 /**
- * 小游戏任务完DTO
+ * 小游戏任务完�?DTO
  */
 @Data
 public class MinigameCompleteDTO {
 
     @NotNull(message = "孩子ID不能为空")
-    private Long childId;
+    private Long memberId;
 
     private Integer completionTime;
 

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/dto/PackagePurchaseDTO.java

@@ -38,7 +38,7 @@ public class PackagePurchaseDTO implements Serializable {
     /**
      * 孩子ID(可选)
      */
-    private Long childId;
+    private Long memberId;
 
     /**
      * 预约日期
@@ -46,7 +46,7 @@ public class PackagePurchaseDTO implements Serializable {
     private String appointmentDate;
 
     /**
-     * 预约时间
+     * 预约时间�?
      */
     private String appointmentTime;
 

+ 5 - 5
cfc-backend/src/main/java/com/etotem/cfc/dto/RecommendRequestDTO.java

@@ -8,21 +8,21 @@ public class RecommendRequestDTO {
     /** 当前维度: body/mind/wisdom/action/wealth */
     private String dimensionCode;
 
-    /** 当前查看的孩子ID(文章/任务用) */
-    private Long childId;
+    /** 当前查看的孩子ID(文�?任务用) */
+    private Long memberId;
 
     /** 返回条数 */
     private Integer size;
 
-    /** 前端已展示的ID列表,用于翻页去*/
+    /** 前端已展示的ID列表,用于翻页去�?*/
     private String excludeIds;
 
     public String getType() { return type; }
     public void setType(String type) { this.type = type; }
     public String getDimensionCode() { return dimensionCode; }
     public void setDimensionCode(String dimensionCode) { this.dimensionCode = dimensionCode; }
-    public Long getChildId() { return childId; }
-    public void setChildId(Long childId) { this.childId = childId; }
+    public Long getChildId() { return memberId; }
+    public void setChildId(Long memberId) { this.memberId = memberId; }
     public Integer getSize() { return size; }
     public void setSize(Integer size) { this.size = size; }
     public String getExcludeIds() { return excludeIds; }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/dto/RewardDTO.java

@@ -11,7 +11,7 @@ private String category;
 private String status;
 private Integer exchangeApproved;
 private Integer progress;
-// REWARD-002B: 支持多孩子隔
-private Long childId;
+// REWARD-002B: 支持多孩子隔�?
+private Long memberId;
 private String childName;
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/RewardExchangeDTO.java

@@ -11,5 +11,5 @@ import javax.validation.constraints.NotNull;
 public class RewardExchangeDTO {
 
     @NotNull(message = "孩子ID不能为空")
-    private Long childId;
+    private Long memberId;
 }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/dto/RewardWishlistDTO.java

@@ -3,10 +3,10 @@ package com.etotem.cfc.dto;
 import lombok.Data;
 
 /**
- * 奖励心愿单查DTO
+ * 奖励心愿单查�?DTO
  */
 @Data
 public class RewardWishlistDTO {
 
-    private Long childId;
+    private Long memberId;
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/ScreenResultVO.java

@@ -9,7 +9,7 @@ import java.util.List;
 @Data
 public class ScreenResultVO implements Serializable {
     private Long id;
-    private Long childId;
+    private Long memberId;
     private String screenType;
     private Integer totalScore;
     private String severityLevel;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/ScreenSubmitDTO.java

@@ -7,7 +7,7 @@ import java.util.List;
 
 @Data
 public class ScreenSubmitDTO implements Serializable {
-    private Long childId;
+    private Long memberId;
     private String screenType;   // PHQ9 / GAD7
     private List<Integer> answers;
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/StudentProgressDTO.java

@@ -8,7 +8,7 @@ import lombok.Data;
  */
 @Data
 public class StudentProgressDTO {
-    private Long childId;
+    private Long memberId;
     private String childName;
     private Integer totalTasks;
     private Integer completedTasks;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/SwitchToChildDTO.java

@@ -7,5 +7,5 @@ import javax.validation.constraints.NotNull;
 @Data
 public class SwitchToChildDTO {
     @NotNull(message = "孩子ID不能为空")
-    private Long childId;
+    private Long memberId;
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/SyncExternalResultDTO.java

@@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull;
 @Data
 public class SyncExternalResultDTO {
     @NotNull(message = "孩子ID不能为空")
-    private Long childId;
+    private Long memberId;
 
     @NotNull(message = "家长ID不能为空")
     private Long parentId;

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/TaskDTO.java

@@ -16,7 +16,7 @@ public class TaskDTO {
     private Date deadline;
     private String category;
     private String status;
-    private Long childId;
+    private Long memberId;
     private String childName;
     private Date createdAt;
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/dto/UpdateChildDTO.java

@@ -5,7 +5,7 @@ import java.util.Date;
 
 @Data
 public class UpdateChildDTO {
-    private Long childId;
+    private Long memberId;
     private String nickname;
     private Integer age;
     private Date birthday;

+ 6 - 6
cfc-backend/src/main/java/com/etotem/cfc/dto/WishDTO.java

@@ -11,11 +11,11 @@ public class WishDTO {
     
     // 归属信息
     private Long familyId;
-    private Long childId;
+    private Long memberId;
     private String childName;      // 孩子昵称(关联查询)
     private Long createdBy;
     private String creatorType;
-    private String creatorName;    // 创建者名
+    private String creatorName;    // 创建者名�?
     
     // 心愿内容
     private String title;
@@ -26,13 +26,13 @@ public class WishDTO {
     private Integer pointsRequired;
     private Long pointsSetBy;
     
-    // 状
+    // 状�?
     private String status;
-    private String statusText;     // 状态中文描
+    private String statusText;     // 状态中文描�?
     
     // 进度信息
     private Integer currentPoints; // 当前积分
-    private Integer progress;      // 进度百分
+    private Integer progress;      // 进度百分�?
     
     // 时间信息
     private String createdAt;
@@ -42,7 +42,7 @@ public class WishDTO {
     // Explicit setters (Lombok fallback)
     public void setId(Long id) { this.id = id; }
     public void setFamilyId(Long familyId) { this.familyId = familyId; }
-    public void setChildId(Long childId) { this.childId = childId; }
+    public void setChildId(Long memberId) { this.memberId = memberId; }
     public void setChildName(String childName) { this.childName = childName; }
     public void setCreatedBy(Long createdBy) { this.createdBy = createdBy; }
     public void setCreatorType(String creatorType) { this.creatorType = creatorType; }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/AIService.java

@@ -336,9 +336,9 @@ public class AIService {
      * based on the child's recent checkin history.
      * Detects consecutive negative checkins and includes them as context.
      */
-    public String buildMindContextPrompt(Long childId) {
+    public String buildMindContextPrompt(Long memberId) {
         // Get latest 7 checkins
-        List<EmotionCheckin> recent = emotionCheckinMapper.selectLatestByChildId(childId, 7);
+        List<EmotionCheckin> recent = emotionCheckinMapper.selectLatestByChildId(memberId, 7);
         if (recent == null || recent.isEmpty()) {
             return "用户暂无情绪打卡记录。";
         }

+ 5 - 5
cfc-backend/src/main/java/com/etotem/cfc/service/ActivityFeedbackService.java

@@ -16,11 +16,11 @@ public class ActivityFeedbackService {
     @Resource
     private ActivityFeedbackMapper activityFeedbackMapper;
 
-    public Result<?> submit(Long activityId, Long userId, Long childId, String ratings, String comment) {
+    public Result<?> submit(Long activityId, Long userId, Long memberId, String ratings, String comment) {
         ActivityFeedback feedback = new ActivityFeedback();
         feedback.setActivityId(activityId);
         feedback.setUserId(userId);
-        feedback.setChildId(childId);
+        feedback.setChildId(memberId);
         feedback.setRatings(ratings);
         feedback.setComment(comment);
         feedback.setStatus(0);
@@ -37,11 +37,11 @@ public class ActivityFeedbackService {
         return Result.success(list);
     }
 
-    public Result<?> getMyFeedback(Long activityId, Long childId) {
+    public Result<?> getMyFeedback(Long activityId, Long memberId) {
         QueryWrapper<ActivityFeedback> wrapper = new QueryWrapper<>();
         wrapper.eq("activity_id", activityId);
-        if (childId != null) {
-            wrapper.eq("child_id", childId);
+        if (memberId != null) {
+            wrapper.eq("child_id", memberId);
         }
         wrapper.orderByDesc("created_at").last("LIMIT 1");
         ActivityFeedback feedback = activityFeedbackMapper.selectOne(wrapper);

+ 11 - 11
cfc-backend/src/main/java/com/etotem/cfc/service/ActivityOrderService.java

@@ -70,12 +70,12 @@ public class ActivityOrderService {
             String name = (String) reg.get("name");
             if (name == null || name.trim().isEmpty()) return Result.error("报名人姓名不能为空");
             String phone = (String) reg.get("phone");
-            Object childIdObj = reg.get("childId");
-            Long childId = childIdObj != null ? Long.valueOf(childIdObj.toString()) : null;
-            if (childId != null && isRegistered(activityId, childId)) {
+            Object memberIdObj = reg.get("memberId");
+            Long memberId = memberIdObj != null ? Long.valueOf(memberIdObj.toString()) : null;
+            if (memberId != null && isRegistered(activityId, memberId)) {
                 return Result.error("已报名: " + name);
             }
-            boolean isChild = childId != null;
+            boolean isChild = memberId != null;
             Integer fee = isChild
                     ? (isMember ? activity.getChildMemberFee() : activity.getChildFee())
                     : (isMember ? activity.getParentMemberFee() : activity.getParentFee());
@@ -84,7 +84,7 @@ public class ActivityOrderService {
             Map<String, Object> item = new HashMap<>();
             item.put("name", name.trim());
             item.put("phone", phone != null ? phone.trim() : null);
-            item.put("childId", childId);
+            item.put("memberId", memberId);
             item.put("type", isChild ? "child" : "parent");
             item.put("fee", fee);
             snapshot.add(item);
@@ -170,13 +170,13 @@ public class ActivityOrderService {
     private List<Long> writeRegistrations(Long activityId, Long userId, List<Map<String, Object>> snapshot, String status) {
         List<Long> ids = new ArrayList<>();
         for (Map<String, Object> item : snapshot) {
-            Object childIdObj = item.get("childId");
-            Long childId = childIdObj != null ? Long.valueOf(childIdObj.toString()) : null;
-            if (childId != null && isRegistered(activityId, childId)) continue;
+            Object memberIdObj = item.get("memberId");
+            Long memberId = memberIdObj != null ? Long.valueOf(memberIdObj.toString()) : null;
+            if (memberId != null && isRegistered(activityId, memberId)) continue;
             ActivityRegistration ar = new ActivityRegistration();
             ar.setActivityId(activityId);
             ar.setUserId(userId);
-            ar.setChildId(childId);
+            ar.setChildId(memberId);
             ar.setRegistrantName((String) item.get("name"));
             ar.setRegistrantPhone((String) item.get("phone"));
             ar.setStatus(status);
@@ -189,10 +189,10 @@ public class ActivityOrderService {
         return ids;
     }
 
-    private boolean isRegistered(Long activityId, Long childId) {
+    private boolean isRegistered(Long activityId, Long memberId) {
         return registrationMapper.selectOne(new LambdaQueryWrapper<ActivityRegistration>()
             .eq(ActivityRegistration::getActivityId, activityId)
-            .eq(ActivityRegistration::getChildId, childId)
+            .eq(ActivityRegistration::getChildId, memberId)
             .in(ActivityRegistration::getStatus, "pending", "approved").last("LIMIT 1")) != null;
     }
 

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/ActivityProvisionService.java

@@ -88,7 +88,7 @@ public class ActivityProvisionService {
     }
 
     @Transactional
-    public Result<String> signIn(Long orderId, Long childId) {
+    public Result<String> signIn(Long orderId, Long memberId) {
         ActivityProvision provision = activityProvisionMapper.selectOne(
             new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<ActivityProvision>()
                 .eq(ActivityProvision::getOrderId, orderId)
@@ -99,7 +99,7 @@ public class ActivityProvisionService {
         if (!"provisioned".equals(provision.getStatus())) {
             return Result.error("当前状态不允许签到");
         }
-        provision.setChildId(childId);
+        provision.setChildId(memberId);
         provision.setCheckedInAt(new Date());
         provision.setStatus("signed_in");
         provision.setUpdatedAt(new Date());

+ 21 - 21
cfc-backend/src/main/java/com/etotem/cfc/service/ActivityRegistrationService.java

@@ -46,15 +46,15 @@ public class ActivityRegistrationService {
             String name = (String) reg.get("name");
             if (name == null || name.trim().isEmpty()) return Result.error("报名人姓名不能为空");
             String phone = (String) reg.get("phone");
-            Object childIdObj = reg.get("childId");
-            Long childId = childIdObj != null ? Long.valueOf(childIdObj.toString()) : null;
-            if (childId != null) {
-                if (isRegistered(activityId, childId)) {
+            Object memberIdObj = reg.get("memberId");
+            Long memberId = memberIdObj != null ? Long.valueOf(memberIdObj.toString()) : null;
+            if (memberId != null) {
+                if (isRegistered(activityId, memberId)) {
                     return Result.error("已报名: " + name);
                 }
             }
             ActivityRegistration ar = new ActivityRegistration();
-            ar.setActivityId(activityId); ar.setUserId(userId); ar.setChildId(childId);
+            ar.setActivityId(activityId); ar.setUserId(userId); ar.setChildId(memberId);
             ar.setRegistrantName(name.trim()); ar.setRegistrantPhone(phone != null ? phone.trim() : null);
             ar.setStatus("pending"); ar.setRegisteredAt(LocalDateTime.now());
             ar.setCreatedAt(LocalDateTime.now()); ar.setUpdatedAt(LocalDateTime.now());
@@ -68,7 +68,7 @@ public class ActivityRegistrationService {
     }
 
     @Transactional
-    public Result<Map<String, Object>> register(Long activityId, Long userId, Long childId) {
+    public Result<Map<String, Object>> register(Long activityId, Long userId, Long memberId) {
         Activity activity = activityMapper.selectById(activityId);
         if (activity == null) return Result.error("活动不存在");
         if (!"published".equals(activity.getStatus())) return Result.error("活动未发布");
@@ -77,9 +77,9 @@ public class ActivityRegistrationService {
         }
         Result<Void> gate = checkRegistrationGate(activity, userId);
         if (gate != null) return Result.error(gate.getMessage());
-        if (isRegistered(activityId, childId)) return Result.error("您已报名此活动");
+        if (isRegistered(activityId, memberId)) return Result.error("您已报名此活动");
         ActivityRegistration reg = new ActivityRegistration();
-        reg.setActivityId(activityId); reg.setUserId(userId); reg.setChildId(childId);
+        reg.setActivityId(activityId); reg.setUserId(userId); reg.setChildId(memberId);
         reg.setStatus("pending"); reg.setRegisteredAt(LocalDateTime.now());
         reg.setCreatedAt(LocalDateTime.now()); reg.setUpdatedAt(LocalDateTime.now());
         registrationMapper.insert(reg);
@@ -89,8 +89,8 @@ public class ActivityRegistrationService {
     }
 
     @Transactional
-    public Result<Void> cancel(Long activityId, Long userId, Long childId) {
-        ActivityRegistration reg = findRegistration(activityId, childId, userId, "pending");
+    public Result<Void> cancel(Long activityId, Long userId, Long memberId) {
+        ActivityRegistration reg = findRegistration(activityId, memberId, userId, "pending");
         if (reg == null) return Result.error("报名记录不存在");
         reg.setStatus("cancelled"); reg.setUpdatedAt(LocalDateTime.now());
         registrationMapper.updateById(reg);
@@ -119,14 +119,14 @@ public class ActivityRegistrationService {
         return Result.success(null);
     }
 
-    public Result<Map<String, Object>> getMyRegistrations(Long userId, Long childId, Integer page, Integer size) {
+    public Result<Map<String, Object>> getMyRegistrations(Long userId, Long memberId, Integer page, Integer size) {
         if (page == null || page < 1) page = 1;
         if (size == null || size < 1) size = 10;
         LambdaQueryWrapper<ActivityRegistration> wrapper = new LambdaQueryWrapper<>();
         if (userId != null) wrapper.eq(ActivityRegistration::getUserId, userId);
-        if (childId != null) {
+        if (memberId != null) {
             // 手动录入的报名 child_id 为 NULL,也属于该用户,需一并返回
-            wrapper.and(w -> w.eq(ActivityRegistration::getChildId, childId)
+            wrapper.and(w -> w.eq(ActivityRegistration::getChildId, memberId)
                 .or().isNull(ActivityRegistration::getChildId));
         }
         wrapper.orderByDesc(ActivityRegistration::getRegisteredAt);
@@ -134,7 +134,7 @@ public class ActivityRegistrationService {
         List<Map<String, Object>> records = pageResult.getRecords().stream().map(reg -> {
             Map<String, Object> item = new HashMap<>();
             item.put("id", reg.getId()); item.put("activityId", reg.getActivityId());
-            item.put("childId", reg.getChildId()); item.put("status", reg.getStatus());
+            item.put("memberId", reg.getChildId()); item.put("status", reg.getStatus());
             item.put("registrantName", reg.getRegistrantName());
             item.put("registrantPhone", reg.getRegistrantPhone());
             item.put("registeredAt", reg.getRegisteredAt());
@@ -158,7 +158,7 @@ public class ActivityRegistrationService {
         List<ActivityRegistration> list = registrationMapper.selectList(wrapper);
         List<Map<String, Object>> result = list.stream().map(reg -> {
             Map<String, Object> item = new HashMap<>();
-            item.put("id", reg.getId()); item.put("childId", reg.getChildId());
+            item.put("id", reg.getId()); item.put("memberId", reg.getChildId());
             item.put("userId", reg.getUserId()); item.put("status", reg.getStatus());
             item.put("registrantName", reg.getRegistrantName());
             item.put("registrantPhone", reg.getRegistrantPhone());
@@ -228,24 +228,24 @@ public class ActivityRegistrationService {
             .eq(ActivityOrder::getStatus, "paid")) > 0;
     }
 
-    public boolean isRegistered(Long activityId, Long childId) {
+    public boolean isRegistered(Long activityId, Long memberId) {
         return registrationMapper.selectOne(new LambdaQueryWrapper<ActivityRegistration>()
             .eq(ActivityRegistration::getActivityId, activityId)
-            .eq(ActivityRegistration::getChildId, childId)
+            .eq(ActivityRegistration::getChildId, memberId)
             .in(ActivityRegistration::getStatus, "pending", "approved").last("LIMIT 1")) != null;
     }
 
-    public boolean isApproved(Long activityId, Long childId) {
+    public boolean isApproved(Long activityId, Long memberId) {
         return registrationMapper.selectOne(new LambdaQueryWrapper<ActivityRegistration>()
             .eq(ActivityRegistration::getActivityId, activityId)
-            .eq(ActivityRegistration::getChildId, childId)
+            .eq(ActivityRegistration::getChildId, memberId)
             .eq(ActivityRegistration::getStatus, "approved").last("LIMIT 1")) != null;
     }
 
-    private ActivityRegistration findRegistration(Long activityId, Long childId, Long userId, String status) {
+    private ActivityRegistration findRegistration(Long activityId, Long memberId, Long userId, String status) {
         LambdaQueryWrapper<ActivityRegistration> wrapper = new LambdaQueryWrapper<ActivityRegistration>()
             .eq(ActivityRegistration::getActivityId, activityId)
-            .eq(ActivityRegistration::getChildId, childId)
+            .eq(ActivityRegistration::getChildId, memberId)
             .eq(ActivityRegistration::getUserId, userId);
         if (status != null) wrapper.eq(ActivityRegistration::getStatus, status);
         wrapper.last("LIMIT 1");

+ 20 - 20
cfc-backend/src/main/java/com/etotem/cfc/service/ActivityService.java

@@ -187,7 +187,7 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
     }
 
     @Transactional
-    public Map<String, Object> checkin(Long activityId, Long userId, Long childId) {
+    public Map<String, Object> checkin(Long activityId, Long userId, Long memberId) {
         Map<String, Object> result = new HashMap<>();
         result.put("taskId", null);
         result.put("pointsEarned", 0);
@@ -214,14 +214,14 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
             return result;
         }
 
-        // 2. If no childId, can't create task
-        if (childId == null) {
+        // 2. If no memberId, can't create task
+        if (memberId == null) {
             result.put("error", "需要孩子身份签到");
             return result;
         }
 
         // 2.5 Identity: phone child self-checkin only; phone-less child allows same-family proxy
-        FamilyMember child = familyMemberMapper.selectById(childId);
+        FamilyMember child = familyMemberMapper.selectById(memberId);
         if (child == null) {
             result.put("error", "孩子不存在");
             return result;
@@ -246,8 +246,8 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
         // 3. Registration check (if activity requires registration)
         boolean unregistered = false;
         if (activity.getRequireRegistration() != null && activity.getRequireRegistration() == 1) {
-            boolean isApproved = registrationService.isApproved(activityId, childId);
-            boolean isRegistered = registrationService.isRegistered(activityId, childId);
+            boolean isApproved = registrationService.isApproved(activityId, memberId);
+            boolean isRegistered = registrationService.isRegistered(activityId, memberId);
             if (!isApproved) {
                 if (isRegistered) {
                     result.put("error", "报名待审核,请等待审核通过");
@@ -259,23 +259,23 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
                 if (penaltyAmount != null && penaltyAmount > 0) {
                     try {
                         int deducted = energyService.deductEnergyByCode(
-                            childId,
+                            memberId,
                             activity.getDimensionCode(),
                             penaltyAmount,
                             "未报名签到活动《" + activity.getTitle() + "》"
                         );
                         if (deducted >= 0) {
                             result.put("energyPenalty", penaltyAmount);
-                            log.info("未报名签到能量扣减: childId={}, activityId={}, penalty={}, dimension={}",
-                                childId, activityId, penaltyAmount, activity.getDimensionCode());
+                            log.info("未报名签到能量扣减: memberId={}, activityId={}, penalty={}, dimension={}",
+                                memberId, activityId, penaltyAmount, activity.getDimensionCode());
                         } else {
                             result.put("energyPenaltyFailed", "余额不足");
-                            log.warn("未报名签到能量扣减失败(余额不足): childId={}, activityId={}",
-                                childId, activityId);
+                            log.warn("未报名签到能量扣减失败(余额不足): memberId={}, activityId={}",
+                                memberId, activityId);
                         }
                     } catch (Exception e) {
-                        log.warn("能量扣减异常: childId={}, activityId={}, error={}",
-                            childId, activityId, e.getMessage());
+                        log.warn("能量扣减异常: memberId={}, activityId={}, error={}",
+                            memberId, activityId, e.getMessage());
                         result.put("energyPenaltyFailed", e.getMessage());
                     }
                 }
@@ -287,7 +287,7 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
             new LambdaQueryWrapper<Task>()
                 .eq(Task::getSourceType, "activity")
                 .eq(Task::getSourceId, activityId)
-                .eq(Task::getChildId, childId)
+                .eq(Task::getChildId, memberId)
                 .last("LIMIT 1")
         );
         if (existingTask != null) {
@@ -315,8 +315,8 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
         }
         task.setCreatorId(userId);
         task.setExecutorType("child");
-        task.setExecutorId(childId);
-        task.setChildId(childId);
+        task.setExecutorId(memberId);
+        task.setChildId(memberId);
         task.setTitle("活动签到: " + activity.getTitle());
         task.setDescription("自动生成 - 签到活动《" + activity.getTitle() + "》");
         task.setPoints(points);
@@ -355,7 +355,7 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
 
         // 8. Insert PointsLog
         PointsLog pointsLog = new PointsLog();
-        pointsLog.setChildId(childId);
+        pointsLog.setChildId(memberId);
         pointsLog.setTaskId(task.getId());
         pointsLog.setAmount(points);
         pointsLog.setType("earn");
@@ -366,11 +366,11 @@ public class ActivityService extends ServiceImpl<ActivityMapper, Activity> {
 
         // 9. Award energy via EnergyService
         try {
-            energyService.awardEnergy(childId, "activity", activityId, points,
+            energyService.awardEnergy(memberId, "activity", activityId, points,
                 "活动签到: " + activity.getTitle(), null);
         } catch (Exception e) {
-            log.warn("能量发放失败(不影响积分): childId={}, activityId={}, error={}",
-                childId, activityId, e.getMessage());
+            log.warn("能量发放失败(不影响积分): memberId={}, activityId={}, error={}",
+            memberId, activityId, e.getMessage());
         }
 
         // 10. Return result

+ 6 - 6
cfc-backend/src/main/java/com/etotem/cfc/service/AiContextService.java

@@ -150,8 +150,8 @@ public class AiContextService {
         result.put("数据类型", "任务进度");
 
         Long targetUserId = userId;
-        if (params != null && params.get("childId") != null) {
-            targetUserId = Long.valueOf(params.get("childId").toString());
+        if (params != null && params.get("memberId") != null) {
+            targetUserId = Long.valueOf(params.get("memberId").toString());
         }
 
         List<ChildInfoDTO> children = userService.getChildren(userId);
@@ -159,10 +159,10 @@ public class AiContextService {
         List<Map<String, Object>> childTaskList = new ArrayList<>();
         if (children != null) {
             for (ChildInfoDTO child : children) {
-                Long childId = child.getId();
+                Long memberId = child.getId();
                 if (targetUserId != null && !targetUserId.equals(userId)) {
-                    // 如果指定了 childId,只返回该孩子
-                    if (!childId.equals(targetUserId)) {
+                    // 如果指定了 memberId,只返回该孩子
+                    if (!memberId.equals(targetUserId)) {
                         continue;
                     }
                 }
@@ -170,7 +170,7 @@ public class AiContextService {
                 childTasks.put("姓名", child.getNickname() != null ? child.getNickname() : "");
                 childTasks.put("年龄", child.getAge() != null ? child.getAge() : 0);
 
-                Map<String, Object> stats = taskService.getChildTaskStats(childId);
+                Map<String, Object> stats = taskService.getChildTaskStats(memberId);
                 childTasks.put("任务完成率", stats.getOrDefault("completionRate", 0) + "%");
                 childTasks.put("完成任务数", stats.getOrDefault("completedCount", 0));
                 childTasks.put("总任务数", stats.getOrDefault("totalCount", 0));

+ 24 - 24
cfc-backend/src/main/java/com/etotem/cfc/service/ArticleService.java

@@ -158,7 +158,7 @@ public class ArticleService {
     }
 
     @Transactional
-    public Map<String, Object> recordRead(Long articleId, Long userId, Long childId, int durationSeconds) {
+    public Map<String, Object> recordRead(Long articleId, Long userId, Long memberId, int durationSeconds) {
         Map<String, Object> result = new HashMap<>();
         result.put("taskId", null);
         result.put("pointsEarned", 0);
@@ -172,15 +172,15 @@ public class ArticleService {
         // 2. Save reading record
         ArticleReadingRecord record = new ArticleReadingRecord();
         record.setUserId(userId);
-        record.setChildId(childId);
+        record.setChildId(memberId);
         record.setContent("");
         record.setDurationSeconds(durationSeconds);
         record.setReadAt(new Date());
         record.setCreatedAt(new Date());
         articleReadingRecordMapper.insert(record);
 
-        // 3. If no childId, can't create task (reading as parent, not child)
-        if (childId == null) {
+        // 3. If no memberId, can't create task (reading as parent, not child)
+        if (memberId == null) {
             return result;
         }
 
@@ -209,7 +209,7 @@ public class ArticleService {
                 new LambdaQueryWrapper<Task>()
                         .eq(Task::getSourceType, "article")
                         .eq(Task::getSourceId, articleId)
-                        .eq(Task::getChildId, childId)
+                        .eq(Task::getChildId, memberId)
                         .last("LIMIT 1")
         );
         if (existingTask != null) {
@@ -239,8 +239,8 @@ public class ArticleService {
         task.setFamilyId(null); // will set after getting child
         task.setCreatorId(userId);
         task.setExecutorType("child");
-        task.setExecutorId(childId);
-        task.setChildId(childId);
+        task.setExecutorId(memberId);
+        task.setChildId(memberId);
         task.setTitle("阅读文章: " + article.getTitle());
         task.setDescription("自动生成 - 阅读文章《" + article.getTitle() + "》" + durationSeconds + "秒");
         task.setPoints(points);
@@ -264,7 +264,7 @@ public class ArticleService {
         task.setDeadline(cal.getTime());
 
         // Get child to set familyId
-        FamilyMember child = familyMemberMapper.selectById(childId);
+        FamilyMember child = familyMemberMapper.selectById(memberId);
         if (child != null) {
             task.setFamilyId(child.getFamilyId());
         }
@@ -280,7 +280,7 @@ public class ArticleService {
 
         // 10. Insert PointsLog
         PointsLog pointsLog = new PointsLog();
-        pointsLog.setChildId(childId);
+        pointsLog.setChildId(memberId);
         pointsLog.setTaskId(task.getId());
         pointsLog.setAmount(points);
         pointsLog.setType("earn");
@@ -291,11 +291,11 @@ public class ArticleService {
 
         // 11. Award energy via EnergyService
         try {
-            energyService.awardEnergy(childId, "article", articleId, points,
+            energyService.awardEnergy(memberId, "article", articleId, points,
                 "阅读文章: " + article.getTitle(), null);
         } catch (Exception e) {
-            log.warn("能量发放失败(不影响积分): childId={}, articleId={}, error={}",
-                childId, articleId, e.getMessage());
+        log.warn("能量发放失败(不影响积分): memberId={}, articleId={}, error={}",
+            memberId, articleId, e.getMessage());
         }
 
         // 12. Link taskId to reading record
@@ -309,13 +309,13 @@ public class ArticleService {
         return result;
     }
 
-    public void reportReadingTime(Long articleId, Long userId, Long childId, int durationSeconds) {
-        if (childId == null) return;
+    public void reportReadingTime(Long articleId, Long userId, Long memberId, int durationSeconds) {
+        if (memberId == null) return;
 
         // 查找当日已有记录(同文章+同孩子)
         LambdaQueryWrapper<ArticleReadingRecord> wrapper = new LambdaQueryWrapper<ArticleReadingRecord>()
                 .eq(ArticleReadingRecord::getArticleId, articleId)
-                .eq(ArticleReadingRecord::getChildId, childId)
+                .eq(ArticleReadingRecord::getChildId, memberId)
                 .apply("DATE(read_at) = CURDATE()")
                 .last("LIMIT 1");
         ArticleReadingRecord existing = articleReadingRecordMapper.selectOne(wrapper);
@@ -330,7 +330,7 @@ public class ArticleService {
             ArticleReadingRecord record = new ArticleReadingRecord();
             record.setArticleId(articleId);
             record.setUserId(userId);
-            record.setChildId(childId);
+        record.setChildId(memberId);
             record.setDurationSeconds(durationSeconds);
             record.setReadAt(new Date());
             record.setCreatedAt(new Date());
@@ -465,7 +465,7 @@ public class ArticleService {
         articleMapper.updateById(article);
     }
 
-    public ReadingStatsDTO getReadingStats(Long childId) {
+    public ReadingStatsDTO getReadingStats(Long memberId) {
         ReadingStatsDTO dto = new ReadingStatsDTO();
 
         Calendar cal = Calendar.getInstance();
@@ -476,11 +476,11 @@ public class ArticleService {
         cal.set(Calendar.MILLISECOND, 0);
         Date since = cal.getTime();
 
-        Integer totalDuration = articleReadingRecordMapper.selectTotalDurationByChildSince(childId, since);
+            Integer totalDuration = articleReadingRecordMapper.selectTotalDurationByChildSince(memberId, since);
         if (totalDuration == null) totalDuration = 0;
 
         LambdaQueryWrapper<ArticleReadingRecord> countWrapper = new LambdaQueryWrapper<ArticleReadingRecord>()
-                .eq(ArticleReadingRecord::getChildId, childId)
+                .eq(ArticleReadingRecord::getChildId, memberId)
                 .ge(ArticleReadingRecord::getReadAt, since);
         Integer totalArticles = Math.toIntExact(articleReadingRecordMapper.selectCount(countWrapper));
 
@@ -527,7 +527,7 @@ public class ArticleService {
      * 根据文章内容和用户画像生成 2 道选择题
      */
     @Transactional
-    public Map<String, Object> getAiQuestions(Long articleId, Long userId, Long childId) {
+    public Map<String, Object> getAiQuestions(Long articleId, Long userId, Long memberId) {
         Map<String, Object> result = new HashMap<>();
 
         // 1. 获取文章
@@ -562,7 +562,7 @@ public class ArticleService {
         ArticleQuizRecord record = new ArticleQuizRecord();
         record.setArticleId(articleId);
         record.setUserId(userId);
-        record.setChildId(childId);
+        record.setChildId(memberId);
         record.setQuestions(questionsJson);
         record.setAnswers(null);
         record.setScore(0);
@@ -587,7 +587,7 @@ public class ArticleService {
     }
 
     @Transactional
-    public Map<String, Object> submitAnswers(Long recordId, String answersJson, Long userId, Long childId) {
+    public Map<String, Object> submitAnswers(Long recordId, String answersJson, Long userId, Long memberId) {
         Map<String, Object> result = new HashMap<>();
 
         // 1. 获取记录
@@ -638,9 +638,9 @@ public class ArticleService {
         articleQuizRecordMapper.updateById(record);
 
         // 5. 发放积分
-        if (pointsEarned > 0 && childId != null) {
+            if (pointsEarned > 0 && memberId != null) {
             try {
-                pointsService.awardSystemPoints(childId, pointsEarned, "AI 阅读答题奖励");
+                pointsService.awardSystemPoints(memberId, pointsEarned, "AI 阅读答题奖励");
             } catch (Exception e) {
                 log.warn("积分发放失败:{}", e.getMessage());
             }

部分文件因为文件数量过多而无法显示