From 9e288e75d85518fd19192c236a40878fd54a0a55 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 6 Feb 2020 16:08:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/get_video_data.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/tasks/get_video_data.rake b/lib/tasks/get_video_data.rake index 49cafcc7b..56af0a192 100644 --- a/lib/tasks/get_video_data.rake +++ b/lib/tasks/get_video_data.rake @@ -28,4 +28,18 @@ namespace :video do puts video.id 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'] + video_id = ENV['args'].split(",")[0] + start_time = ENV['args'].split(",")[1].to_s.to_time.utc.strftime('%Y-%m-%dT%H:%M:%SZ') # 表示参与人数 + end_time = ENV['args'].split(",")[2].to_s.to_time.utc.strftime('%Y-%m-%dT%H:%M:%SZ') # 表示通过人数 + + video=Video.find video_id + data = AliyunVod::Service.video_data(video.uuid, start_time, end_time) + + puts data + end + end end \ No newline at end of file