From 51007d14e9194d833eeedfc5e6c557bfe54b9a72 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Tue, 10 Mar 2020 10:58:18 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=BD=AC=E7=A0=81rake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index a595b77b0..daababf33 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -3,7 +3,7 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do Video.find_each do |v| - if v.uuid && v.transcoded == false && AliyunVod::Service.get_meta_code_info(v.uuid).start_with?("h264", "h265", "flv") == false + if v.uuid && v.transcoded == false && AliyunVod::Service.get_meta_code_info(v.uuid).start_with?("h264", "h265") == false p "--- Start submit video trans code #{v.uuid}" AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') end From fa43b7809cb192a039aed162a6353784e2d2e629 Mon Sep 17 00:00:00 2001 From: anke1460 Date: Tue, 10 Mar 2020 11:10:42 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E8=BD=AC=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index daababf33..7e461224e 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -3,7 +3,7 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do Video.find_each do |v| - if v.uuid && v.transcoded == false && AliyunVod::Service.get_meta_code_info(v.uuid).start_with?("h264", "h265") == false + if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid).start_with?("h264", "h265") p "--- Start submit video trans code #{v.uuid}" AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') end From 88dcf8e8f705fc09b4b50586594703008772e7a6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 11:47:47 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 8 ++++++-- app/services/videos/batch_publish_service.rb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 2e94e435d..de0603868 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -133,13 +133,17 @@ class CoursesController < ApplicationController # 视频移动到目录 def move_to_category + tip_exception("请选择要移动的目录") if params[:new_category_id].blank? category = @course.course_second_categories.find_by(id: params[:new_category_id]) if params[:new_category_id].to_i == 0 || category.present? - videos = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids])) + video = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids])).first + + tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || + video.user_id == current_user.id || current_user.admin_or_business? - videos.update_all(course_second_category_id: params[:new_category_id]) + video.update!(course_second_category_id: params[:new_category_id]) normal_status(0, "操作成功") else normal_status(-1, "目录不存在") diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 9ddcae146..5dd511de7 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -41,7 +41,7 @@ class Videos::BatchPublishService < ApplicationService # 如果是课堂上传则创建课堂记录 Rails.logger.info("#####param: #{ param[:course_id]}") if param[:course_id].present? - course_second_category_id = params[:category_id] || 0 + course_second_category_id = param[:category_id] || 0 video.course_videos.create!(course_id: param[:course_id], course_second_category_id: course_second_category_id) end end From 43d124b1992e115025ccb1172a03b511f5342daa Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 11:58:35 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index de0603868..ebdf8dfda 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -140,8 +140,9 @@ class CoursesController < ApplicationController if params[:new_category_id].to_i == 0 || category.present? video = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids])).first + user_id = video.user_id || video.video.user_id tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || - video.user_id == current_user.id || current_user.admin_or_business? + user_id == current_user.id || current_user.admin_or_business? video.update!(course_second_category_id: params[:new_category_id]) normal_status(0, "操作成功") From d70917fbfc1b3055e66f24b74304dc12a226029b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 10 Mar 2020 12:02:43 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index ebdf8dfda..426820701 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -141,8 +141,7 @@ class CoursesController < ApplicationController video = @course.course_videos.where(video_id: params[:video_ids]).or(@course.course_videos.where(id: params[:video_ids])).first user_id = video.user_id || video.video.user_id - tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || - user_id == current_user.id || current_user.admin_or_business? + tip_exception("您不是课堂管理员或者视频发布者,暂不能移动视频。") unless @user_course_identity < Course::PROFESSOR || user_id == current_user.id video.update!(course_second_category_id: params[:new_category_id]) normal_status(0, "操作成功")