视频删除功能

Adjustreact
daiao 5 years ago
parent dda59f33ef
commit a9d76e6f51

@ -25,7 +25,7 @@ class CoursesController < ApplicationController
:delete_course_teacher, :teacher_application_review, :students, :all_course_groups,
:transfer_to_course_group, :delete_from_course, :search_users, :add_students_by_search,
:base_info, :get_historical_courses, :create_group_by_importing_file, :course_videos,
:attahcment_category_list,:export_member_scores_excel, :duplicate_course,
:attahcment_category_list,:export_member_scores_excel, :duplicate_course, :delete_course_video,
:switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course,
:informs, :update_informs, :online_learning, :update_task_position, :tasks_list,
:join_excellent_course, :export_couser_info, :export_member_act_score, :new_informs,
@ -109,6 +109,15 @@ class CoursesController < ApplicationController
@videos = paginate videos
end
def delete_course_video
video = Video.find_by(uuid: params[:video_id])
tip_exception(404, "找不到资源") if video.blank?
tip_exception(403, "...") if video.user_id != current_user.id || !current_user.admin_or_business?
video.destroy!
AliyunVod::Service.delete_video([video.uuid]) rescue nil
render_ok
end
def visits_plus_one
new_visits = @course.visits + 1
@course.update_visits(new_visits)

@ -516,6 +516,7 @@ Rails.application.routes.draw do
get 'act_score'
get 'statistics'
get 'course_videos'
delete 'delete_course_video'
post :inform_up
post :inform_down
get :calculate_all_shixun_scores

Loading…
Cancel
Save