Quellcode durchsuchen

fix: 会员看课-更新时长,rediskey调整

caoliqin vor 1 Monat
Ursprung
Commit
8663e76e10

+ 3 - 0
fs-service-system/src/main/java/com/fs/course/param/newfs/FsUserCourseVideoUParam.java

@@ -20,4 +20,7 @@ public class FsUserCourseVideoUParam implements Serializable {
 
     private Integer linkType;
 
+    @NotNull(message = "销售id不能为空")
+    private Long companyUserId;
+
 }

+ 2 - 2
fs-service-system/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -1006,7 +1006,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         }
 
         // 从Redis中获取观看时长
-        String redisKey = "h5wxuser:watch:duration:" + param.getUserId() + ":" + param.getVideoId();
+        String redisKey = "h5wxuser:watch:duration:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
         try {
             String durationStr = redisCache.getCacheObject(redisKey);
             long duration = durationStr != null ? Long.parseLong(durationStr) : 0L;
@@ -1073,7 +1073,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 
     //会员-更新心跳时间
     public void updateHeartbeatWx(FsUserCourseVideoUParam param) {
-        String redisKey = "h5wxuser:watch:heartbeat:" + param.getUserId() + ":" + param.getVideoId();
+        String redisKey = "h5wxuser:watch:heartbeat:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
         redisCache.setCacheObject(redisKey, LocalDateTime.now().toString());
         // 设置 Redis 记录的过期时间(例如 5 分钟)
         redisCache.expire(redisKey, 300, TimeUnit.SECONDS);