zyp 3 ngày trước cách đây
mục cha
commit
2edd3ec9b3

+ 1 - 1
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -448,7 +448,7 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
 
     @Select("SELECT * FROM fs_course_watch_log " +
             "WHERE log_type = 2 AND send_finish_msg = 0 " +
-            "AND finish_time >= #{startDate} AND finish_time < #{endDate} and log_id > #{maxId} order by log_id asc  " +
+            "AND send_type = 2 and finish_time >= #{startDate} AND finish_time < #{endDate} and log_id > #{maxId} order by log_id asc  " +
             "LIMIT #{limit}")
     List<FsCourseWatchLog> selectFsCourseWatchLogFinishBatchByDate(
             @Param("startDate") Date startDate,

+ 23 - 4
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -405,15 +405,23 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 
     @Override
     public R updateWatchDuration(FsUserCourseVideoFinishUParam param) {
-        //临时短链不做记录
-        if (param.getLinkType()!=null && param.getLinkType()==1){
-            return R.ok();
-        }
 
         if (param.getIsRoom()!=null&&param.getIsRoom()==1&&param.getQwExternalId()==null){
             return R.ok();
         }
 
+        Long videoDuration = 0L;
+        try {
+            videoDuration = getVideoDuration(param.getVideoId());
+        }catch (Exception e){
+            log.error("视频时长识别错误:{}", param);
+            return R.error();
+        }
+        // 判断param.getDuration()是否大于videoDuration(允许10的误差区间)
+        if (param.getDuration() > videoDuration + 10) {
+            return R.error();
+        }
+
         // 从Redis中获取观看时长
         String redisKey = "h5user:watch:duration:" + param.getQwUserId()+ ":" + param.getQwExternalId() + ":" + param.getVideoId();
 //        log.info("看课redis-key:{}", redisKey);
@@ -2415,6 +2423,17 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         if (param.getCompanyUserId()==null){
             param.setCompanyUserId(0L);
         }
+        Long videoDuration = 0L;
+        try {
+            videoDuration = getVideoDuration(param.getVideoId());
+        }catch (Exception e){
+            log.error("视频时长识别错误:{}", param);
+            return R.error();
+        }
+        // 判断param.getDuration()是否大于videoDuration(允许10的误差区间)
+        if (param.getDuration() > videoDuration + 10) {
+            return R.error();
+        }
         // 从Redis中获取观看时长
         String redisKey = "h5wxuser:watch:duration:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
 //        log.info("看课redis缓存key:{}", redisKey);