فهرست منبع

fix: improve FIRST_TASK onboarding trigger to use task child ID

Use task.getChildId() instead of child.getUserId() for the FIRST_TASK onboarding event trigger. This is more robust as it handles cases where the child record may not be directly associated with the task completion flow.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Xiaogang Liao 4 ماه پیش
والد
کامیت
6374e4a02f
1فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 8 2
      cfc-backend/src/main/java/com/etotem/cfc/service/TaskService.java

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

@@ -578,8 +578,14 @@ return result;
         Map<String, Object> result = new HashMap<>();
         result.put("pointsEarned", pointsEarned);
 
-        try { onboardingService.completeTask(child.getUserId(), "FIRST_TASK"); } catch (Exception e) { /* onboarding trigger failure should not block task completion */ }
-    result.put("newBalance", user.getTotalPoints());
+        // 触发首次任务成长事件(如果有关联的孩子)
+        if (task.getChildId() != null) {
+            Child taskChild = childMapper.selectById(task.getChildId());
+            if (taskChild != null) {
+                try { onboardingService.completeTask(taskChild.getUserId(), "FIRST_TASK"); } catch (Exception e) { /* onboarding trigger failure should not block task completion */ }
+            }
+        }
+    result.put("newBalance", user.getTotalPoints());
     result.put("needReview", task.getNeedReview() == 1);
 
     return result;