This commit is contained in:
tanglong 2025-07-15 13:39:28 +08:00
parent 4d4ff11ee9
commit e813d22174

View File

@ -154,28 +154,28 @@ namespace YD_AllHeartRates.Api.Services.Impl
var jumpRope = _caching.Get<JumpRopeData>(jumpRopeKey);
// ❗心率缓存未命中 → 单独查数据库
if (heartRate == null)
{
heartRate = await _userContext.HeartRateData
.Where(x => x.StudentNo == student.StudentNo && x.ScoreTime >= tenMinutesAgo)
.OrderByDescending(x => x.ScoreTime)
.FirstOrDefaultAsync();
//if (heartRate == null)
//{
// heartRate = await _userContext.HeartRateData
// .Where(x => x.StudentNo == student.StudentNo && x.ScoreTime >= tenMinutesAgo)
// .OrderByDescending(x => x.ScoreTime)
// .FirstOrDefaultAsync();
//if (heartRate != null)
// _caching.AddObject(heartRateKey, heartRate, 60);
}
// //if (heartRate != null)
// // _caching.AddObject(heartRateKey, heartRate, 60);
//}
// ❗跳绳缓存未命中 → 单独查数据库
if (jumpRope == null)
{
jumpRope = await _userContext.JumpRopeData
.Where(x => x.StudentNo == student.StudentNo && x.ScoreTime.Date == now.Date)
.OrderByDescending(x => x.ScoreTime)
.FirstOrDefaultAsync();
//if (jumpRope == null)
//{
// jumpRope = await _userContext.JumpRopeData
// .Where(x => x.StudentNo == student.StudentNo && x.ScoreTime.Date == now.Date)
// .OrderByDescending(x => x.ScoreTime)
// .FirstOrDefaultAsync();
//if (jumpRope != null)
// _caching.AddObject(jumpRopeKey, jumpRope, 60);
}
// //if (jumpRope != null)
// // _caching.AddObject(jumpRopeKey, jumpRope, 60);
//}
// 心率强度判断
int strength = heartRate?.Strength ?? 0;