feat(notifications): 新增晚餐和心情提醒功能,支持HRV压力检测和后台处理
- 新增晚餐提醒(18:00)和心情提醒(21:00)的定时通知 - 实现基于HRV数据的压力检测和智能鼓励通知 - 添加后台任务处理支持,修改iOS后台模式为processing - 优化营养记录页面使用Redux状态管理,支持实时数据更新 - 重构卡路里计算公式,移除目标卡路里概念,改为基代+运动-饮食 - 新增营养目标动态计算功能,基于用户身体数据智能推荐 - 完善通知点击跳转逻辑,支持多种提醒类型的路由处理
This commit is contained in:
@@ -454,6 +454,19 @@ export async function fetchTodayHRV(): Promise<number | null> {
|
||||
return fetchHRVForDate(dayjs().toDate());
|
||||
}
|
||||
|
||||
// 获取最近几小时内的实时HRV数据
|
||||
export async function fetchRecentHRV(hoursBack: number = 2): Promise<number | null> {
|
||||
console.log(`开始获取最近${hoursBack}小时内的HRV数据...`);
|
||||
|
||||
const now = new Date();
|
||||
const options = {
|
||||
startDate: dayjs(now).subtract(hoursBack, 'hour').toDate().toISOString(),
|
||||
endDate: now.toISOString()
|
||||
};
|
||||
|
||||
return fetchHeartRateVariability(options);
|
||||
}
|
||||
|
||||
// 更新healthkit中的体重
|
||||
export async function updateWeight(weight: number) {
|
||||
return new Promise((resolve) => {
|
||||
|
||||
Reference in New Issue
Block a user