|
@@ -1463,8 +1463,10 @@ public class HealthReportController {
|
|
|
// 指定报告:返回该报告的食材推荐
|
|
// 指定报告:返回该报告的食材推荐
|
|
|
foods = foodService.listByReportId(reportId);
|
|
foods = foodService.listByReportId(reportId);
|
|
|
} else {
|
|
} else {
|
|
|
- // 未指定报告:返回维护的"当前食材"推荐(food_recommend_idx,有新报告时 upsert 更新)
|
|
|
|
|
- Long uid = userId != null ? userId : -1L;
|
|
|
|
|
|
|
+ // 未指定报告:优先用 memberId(孩子视角),其次 JWT userId(家长视角)
|
|
|
|
|
+ // food_recommend_idx 以 subjectId 维度写入,家长 JWT userId 查不到孩子的推荐
|
|
|
|
|
+ Long memberId = params != null ? ParamUtils.getLong(params.get("memberId")) : null;
|
|
|
|
|
+ Long uid = memberId != null ? memberId : (userId != null ? userId : -1L);
|
|
|
foods = foodRecommendService.getCurrentFoodsAsFoodList(uid);
|
|
foods = foodRecommendService.getCurrentFoodsAsFoodList(uid);
|
|
|
}
|
|
}
|
|
|
return Result.success(foods);
|
|
return Result.success(foods);
|