|  |  |  | @ -29,6 +29,24 @@ namespace :video do | 
			
		
	
		
			
				
					|  |  |  |  |     end | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   desc "将http修改成http" | 
			
		
	
		
			
				
					|  |  |  |  |   task modify_http_to_https_file_url: :environment do | 
			
		
	
		
			
				
					|  |  |  |  |     p "s" | 
			
		
	
		
			
				
					|  |  |  |  |     if ENV['args'] | 
			
		
	
		
			
				
					|  |  |  |  |       course_id = ENV['args'].split(",")[0] | 
			
		
	
		
			
				
					|  |  |  |  |       video_ids = CourseVideo.where(course_id: course_id).pluck(:video_id) | 
			
		
	
		
			
				
					|  |  |  |  |       videos = Video.where(id: video_ids) | 
			
		
	
		
			
				
					|  |  |  |  |       if videos | 
			
		
	
		
			
				
					|  |  |  |  |         videos.each do |v| | 
			
		
	
		
			
				
					|  |  |  |  |           if v.file_url | 
			
		
	
		
			
				
					|  |  |  |  |             file_url = v.file_url.gsub("http:", "https:") | 
			
		
	
		
			
				
					|  |  |  |  |             v.update_column(:file_url, file_url) | 
			
		
	
		
			
				
					|  |  |  |  |           end | 
			
		
	
		
			
				
					|  |  |  |  |         end | 
			
		
	
		
			
				
					|  |  |  |  |       end | 
			
		
	
		
			
				
					|  |  |  |  |     end | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   # 执行示例  bundle exec rake video:sample args=2933,'2019-08-19 00:00:00','2019-11-09 23:59:59' | 
			
		
	
		
			
				
					|  |  |  |  |   task :sample => :environment do | 
			
		
	
		
			
				
					|  |  |  |  |     if ENV['args'] | 
			
		
	
	
		
			
				
					|  |  |  | 
 |