This commit is contained in:
670788339
2025-03-29 12:22:11 +08:00
parent efdfa6f00c
commit d4964ca7f1

View File

@@ -333,7 +333,7 @@ public class StudyServiceImpl implements IStudyService{
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
String value = lastStudyTime + "&" + now.format(formatter); // 使用ISO8601时间格式
log.info("-study-video-time-----value = " + value);
// 20250303 优化 多次更新改一次更新
// 更新Redis中的最后活跃时间带30秒过期
redisTemplate.opsForValue().set(
@@ -341,12 +341,14 @@ public class StudyServiceImpl implements IStudyService{
value,
Duration.ofSeconds(2592000)
);
log.info("-study-video-time-redis保存---value = " + value);
// Duration.ofDays(30) 也就是 2592000秒
}
@Override
@Transactional
public void updateStudyCourseItemLastTime(String studyContentId, int lastStudyTime,LocalDateTime timestamp) {
log.info("-study-video-time-定时---studyContentId = " + studyContentId + ",lastStudyTime = " + lastStudyTime + ", timestamp = " + timestamp);
// 更新最后的学习时间点
LocalDateTime now=LocalDateTime.now();
UpdateBuilder update=UpdateBuilder.from(StudyCourseItem.class);
@@ -356,6 +358,7 @@ public class StudyServiceImpl implements IStudyService{
update.addUpdateField("lastStudyTime", lastStudyTime);
update.addUpdateField("lastTime", timestamp==null ? now : timestamp);
scItemDao.update(update.builder());
log.info("-study-video-time-mysql保存---studyContentId = " + studyContentId);
}
@Override