|  | @@ -405,15 +405,23 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public R updateWatchDuration(FsUserCourseVideoFinishUParam param) {
 |  |      public R updateWatchDuration(FsUserCourseVideoFinishUParam param) {
 | 
											
												
													
														|  | -        //临时短链不做记录
 |  | 
 | 
											
												
													
														|  | -        if (param.getLinkType()!=null && param.getLinkType()==1){
 |  | 
 | 
											
												
													
														|  | -            return R.ok();
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          if (param.getIsRoom()!=null&¶m.getIsRoom()==1&¶m.getQwExternalId()==null){
 |  |          if (param.getIsRoom()!=null&¶m.getIsRoom()==1&¶m.getQwExternalId()==null){
 | 
											
												
													
														|  |              return R.ok();
 |  |              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中获取观看时长
 |  |          // 从Redis中获取观看时长
 | 
											
												
													
														|  |          String redisKey = "h5user:watch:duration:" + param.getQwUserId()+ ":" + param.getQwExternalId() + ":" + param.getVideoId();
 |  |          String redisKey = "h5user:watch:duration:" + param.getQwUserId()+ ":" + param.getQwExternalId() + ":" + param.getVideoId();
 | 
											
												
													
														|  |  //        log.info("看课redis-key:{}", redisKey);
 |  |  //        log.info("看课redis-key:{}", redisKey);
 | 
											
										
											
												
													
														|  | @@ -2415,6 +2423,17 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
											
												
													
														|  |          if (param.getCompanyUserId()==null){
 |  |          if (param.getCompanyUserId()==null){
 | 
											
												
													
														|  |              param.setCompanyUserId(0L);
 |  |              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中获取观看时长
 |  |          // 从Redis中获取观看时长
 | 
											
												
													
														|  |          String redisKey = "h5wxuser:watch:duration:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
 |  |          String redisKey = "h5wxuser:watch:duration:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
 | 
											
												
													
														|  |  //        log.info("看课redis缓存key:{}", redisKey);
 |  |  //        log.info("看课redis缓存key:{}", redisKey);
 |