diff --git a/app/controllers/users/videos_controller.rb b/app/controllers/users/videos_controller.rb index 1fb209970..4334b3a69 100644 --- a/app/controllers/users/videos_controller.rb +++ b/app/controllers/users/videos_controller.rb @@ -39,6 +39,13 @@ class Users::VideosController < Users::BaseController @videos = paginate videos end + def get_video_data + start_time = params[:start_time].to_time.utc.strftime('%Y-%m-%dT%H:%M:%SZ') + end_time = params[:end_time].to_time.utc.strftime('%Y-%m-%dT%H:%M:%SZ') + result = AliyunVod::Service.video_data(current_video.uuid, start_time, end_time) + render :json => {data: result} + end + def batch_publish Videos::BatchPublishService.call(observed_user, batch_publish_params) render_ok diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c6dd7830c..ee876c2c9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -52,7 +52,7 @@ class UsersController < ApplicationController def attachment_show file_name = params[:file_name] - path = params[:path] + path = params[:path] || edu_setting('attachment_folder') send_file "#{path}/#{file_name}", :filename => "#{file_name}", :type => 'game', :disposition => 'attachment' #inline can open in browser diff --git a/app/helpers/shixuns_helper.rb b/app/helpers/shixuns_helper.rb index 451d4a9a4..4f522512d 100644 --- a/app/helpers/shixuns_helper.rb +++ b/app/helpers/shixuns_helper.rb @@ -152,7 +152,7 @@ module ShixunsHelper challenge_program_name = [] shixun.challenges.map(&:exec_path).each do |exec_path| challenge_program_name << "\"#{exec_path}\"" - if shixun.main_mirror_name == "Java" + if shixun.main_mirror_name == "Java" || shixun.main_mirror_name == "Openjdk10/VNC" if exec_path.nil? || exec_path.split("src/")[1].nil? source = "\"\"" else diff --git a/app/libs/aliyun_vod/service/video_manage.rb b/app/libs/aliyun_vod/service/video_manage.rb index ca32bda13..f3ec9d735 100644 --- a/app/libs/aliyun_vod/service/video_manage.rb +++ b/app/libs/aliyun_vod/service/video_manage.rb @@ -44,7 +44,8 @@ module AliyunVod::Service::VideoManage Action: 'DescribePlayVideoStatis', VideoId: video_id, StartTime: start_time, - EndTime: end_time + EndTime: end_time, + Interval: 'day' }.merge(base_params) result = request(:post, params) diff --git a/app/views/attachment_histories/_attachment_history.json.jbuilder b/app/views/attachment_histories/_attachment_history.json.jbuilder index a2369888f..66031847c 100644 --- a/app/views/attachment_histories/_attachment_history.json.jbuilder +++ b/app/views/attachment_histories/_attachment_history.json.jbuilder @@ -10,3 +10,4 @@ json.created_on attachment.created_on json.is_pdf attachment.is_history_pdf? json.url attachment.is_history_pdf? ? attachment_path(attachment, type: 'history',disposition:"inline") : attachment_path(attachment, type: 'history') json.attachment_id attachment.attachment_id +json.content_type attachment.content_type diff --git a/app/views/attachments/_attachment.json.jbuilder b/app/views/attachments/_attachment.json.jbuilder index 91d89a87e..b30869d57 100644 --- a/app/views/attachments/_attachment.json.jbuilder +++ b/app/views/attachments/_attachment.json.jbuilder @@ -15,3 +15,4 @@ json.created_on attachment.created_on json.content_type attachment.content_type json.is_pdf attachment.is_pdf? json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment) +json.play_url attachment_show_users_path(file_name: local_path(attachment)) diff --git a/app/views/attachments/_attachment_small.json.jbuilder b/app/views/attachments/_attachment_small.json.jbuilder index 853c14b40..8b26a12bf 100644 --- a/app/views/attachments/_attachment_small.json.jbuilder +++ b/app/views/attachments/_attachment_small.json.jbuilder @@ -4,3 +4,4 @@ json.filesize number_to_human_size(attachment.filesize) json.is_pdf attachment.is_pdf? json.url attachment.is_pdf? ? download_url(attachment,disposition:"inline") : download_url(attachment) json.created_on attachment.created_on +json.content_type attachment.content_type diff --git a/config/routes.rb b/config/routes.rb index 80371b181..3eb02c95d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -197,6 +197,9 @@ Rails.application.routes.draw do post :batch_publish post :cancel end + member do + get :get_video_data + end end resource :video_auths, only: [:create, :update] end diff --git a/lib/tasks/get_video_data.rake b/lib/tasks/get_video_data.rake index 08ef1acb7..56af0a192 100644 --- a/lib/tasks/get_video_data.rake +++ b/lib/tasks/get_video_data.rake @@ -1,14 +1,45 @@ namespace :video do desc "get video play data" task :data => :environment do - start_time = [Time.utc(2019,8,19,0,0,0), Time.utc(2019,11,10,0,0,0)] - end_time = [Time.utc(2019,11,09,23,59,59), Time.utc(2020,2,6,23,59,59)] + start_times = ['2019-08-19 00:00:00', '2019-11-10 00:00:00'] + end_times = ['2019-11-09 23:59:59', '2020-02-06 00:00:00'] Video.all.each do |video| vv = 0 play_duration = 0 + start_times.each_with_index do |time, index| + start_time = time.to_time.utc.strftime('%Y-%m-%dT%H:%M:%SZ') + end_time = end_times[index].to_time.utc.strftime('%Y-%m-%dT%H:%M:%SZ') + data = AliyunVod::Service.video_data(video.uuid, start_time, end_time) + + puts data + if data[:VideoPlayStatisDetails].present? + sum_duration = data[:VideoPlayStatisDetails][:VideoPlayStatisDetail].map(&:PlayDuration).sum + sum_vv = data[:VideoPlayStatisDetails][:VideoPlayStatisDetail].map(&:vv).sum + + vv += sum_vv + play_duration += sum_duration + end + end + + video.update!(vv: vv, play_duration: play_duration) + 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 diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.css b/public/react/src/modules/user/usersInfo/video/InfosVideo.css index 39e0ff123..f2b1d5152 100644 --- a/public/react/src/modules/user/usersInfo/video/InfosVideo.css +++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.css @@ -20,7 +20,7 @@ } .videoItem img.cover { width: 100%; - border-radius: 6px 6px 0px 0px; + border-radius: 12px 12px 0px 0px; height: 158px; } .nItem.videoItem:hover .mask { @@ -34,12 +34,12 @@ display: inline-block; } .nItem .mask { - border-radius: 6px 6px 0px 0px; + border-radius: 12px 12px 0px 0px; display: none; text-align: center; position: absolute; - background: #000; - opacity: 0.5; + background:rgba(0,0,0,0.39); + /*opacity: 0.5;*/ } .videoItem .playWrap { display: none; @@ -49,6 +49,7 @@ position: absolute; top: 0px; left: 0px; + cursor: pointer; } .videoItem img.play { margin-top: 20%; @@ -57,9 +58,9 @@ } .videoItem .square-main { padding: 9px 8px; - + background: #fff; - border-radius: 0px 0px 6px 6px; + border-radius:12px; } .videoItem .square-main .title{ max-width: 256px; @@ -71,7 +72,11 @@ background: #EAEAEA; } .videoItem .time { - color: #A0A0A0; + color: #C0C4CC; +} +.videoItem .square-main .buttonRow .dianjilianicon{ + color: #606266 !important; + font-size: 14px !important; } .videoItem .square-main .buttonRow { @@ -80,8 +85,8 @@ } .nItem.videoItem:hover .square-main { - color: #fff; - background: #333; + /*color: #fff;*/ + background: #fff; } /* 预览弹框 */ @@ -117,4 +122,24 @@ .infoVideo .toUploadBtn { height: 48px; margin-right: 20px; +} + +.play_duration{ + width: 100%; + height:30px; + background:rgba(0,0,0,0.39); + /*opacity:0.39;*/ + color:#fff; + font-size:12px; + line-height:30px; + text-align: right; + padding-right: 10px; +} +.mp23{ + margin-bottom: 23px; +} + +.videoItem:hover{ + box-shadow:0px 4px 10px 0px rgba(3,7,45,0.1); + border-radius:12px; } \ No newline at end of file diff --git a/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js b/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js index 23fdaf450..1bba7ac03 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js +++ b/public/react/src/modules/user/usersInfo/video/VideoInReviewItem.js @@ -20,13 +20,13 @@ const clipboardMap = {} function VideoInReviewItem (props) { const theme = useContext(ThemeContext); const { history, file_url, cover_url, title, created_at, published_at, isReview, id - , onEditVideo, onMaskClick, getCopyText, showNotification } = props; + , onEditVideo, onMaskClick, getCopyText, showNotification,vv,play_duration} = props; useEffect(()=> { if (!isReview) { _clipboard = new ClipboardJS(`.copybtn_item_${id}`); _clipboard.on('success', (e) => { showNotification('复制成功') - }); + }); clipboardMap[id] = _clipboard } return () => { @@ -45,28 +45,37 @@ function VideoInReviewItem (props) { } return (