|
|
|
@ -116,11 +116,18 @@ class CoursesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def delete_course_video
|
|
|
|
|
video = Video.find_by(id: params[:video_id])
|
|
|
|
|
tip_exception(404, "找不到资源") if video.blank?
|
|
|
|
|
tip_exception(403, "...") unless (video.user_id == current_user.id || current_user.admin_or_business?)
|
|
|
|
|
video.destroy!
|
|
|
|
|
AliyunVod::Service.delete_video([video.uuid]) rescue nil
|
|
|
|
|
if params[:is_link]
|
|
|
|
|
video = @course.course_videos.find_by!(id: params[:video_id])
|
|
|
|
|
tip_exception(403, "...") unless (video.user_id == current_user.id || current_user.admin_or_business?)
|
|
|
|
|
video.destroy!
|
|
|
|
|
else
|
|
|
|
|
video = Video.find_by(id: params[:video_id])
|
|
|
|
|
tip_exception(404, "找不到资源") if video.blank?
|
|
|
|
|
tip_exception(403, "...") unless (video.user_id == current_user.id || current_user.admin_or_business?)
|
|
|
|
|
video.destroy!
|
|
|
|
|
AliyunVod::Service.delete_video([video.uuid]) rescue nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
render_ok
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|