|  | @@ -2425,7 +2425,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          Long videoDuration = 0L;
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  | -            videoDuration = getVideoDuration(param.getVideoId());
 | 
	
		
			
				|  |  | +            videoDuration = getAutoLookVideoDuration(param.getVideoId());
 | 
	
		
			
				|  |  |          }catch (Exception e){
 | 
	
		
			
				|  |  |              log.error("视频时长识别错误:{}", param);
 | 
	
		
			
				|  |  |              return R.error();
 | 
	
	
		
			
				|  | @@ -2920,6 +2920,30 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 | 
	
		
			
				|  |  |          return duration;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     * 获取视频时长(优先从Redis获取,不存在则查数据库)
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private Long getAutoLookVideoDuration(Long videoId) {
 | 
	
		
			
				|  |  | +        //将视频时长也存到redis
 | 
	
		
			
				|  |  | +        String videoRedisKey = "h5wxuser:video:duration:" + videoId;
 | 
	
		
			
				|  |  | +        Long videoDuration=0L;
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            videoDuration = redisCache.getCacheObject(videoRedisKey);
 | 
	
		
			
				|  |  | +        }catch (Exception e){
 | 
	
		
			
				|  |  | +            String string = redisCache.getCacheObject(videoRedisKey);
 | 
	
		
			
				|  |  | +            videoDuration=Long.parseLong(string);
 | 
	
		
			
				|  |  | +            log.error("key中id为S:{}", videoDuration);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if (videoDuration==null){
 | 
	
		
			
				|  |  | +            FsUserCourseVideo video = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(videoId);
 | 
	
		
			
				|  |  | +            videoDuration=video.getDuration();
 | 
	
		
			
				|  |  | +            redisCache.setCacheObject(videoRedisKey,video.getDuration());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return videoDuration;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 时长校验服务实现
 | 
	
		
			
				|  |  |       *
 |