|
|
@ -1,6 +1,6 @@
|
|
|
|
class Users::VideosController < Users::BaseController
|
|
|
|
class Users::VideosController < Users::BaseController
|
|
|
|
before_action :private_user_resources!, :check_account
|
|
|
|
before_action :private_user_resources!, :check_account
|
|
|
|
before_action :require_teacher!
|
|
|
|
before_action :require_teacher!, except: [:destroy]
|
|
|
|
before_action :require_auth_teacher!, except: [:index, :review]
|
|
|
|
before_action :require_auth_teacher!, except: [:index, :review]
|
|
|
|
|
|
|
|
|
|
|
|
helper_method :current_video
|
|
|
|
helper_method :current_video
|
|
|
@ -53,6 +53,19 @@ class Users::VideosController < Users::BaseController
|
|
|
|
render_error(ex.message)
|
|
|
|
render_error(ex.message)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
|
|
|
|
video = observed_user.videos.find_by(id: params[:video_id])
|
|
|
|
|
|
|
|
render_forbidden unless video.user_id != observed_user.id || !current_user.admin_or_business?
|
|
|
|
|
|
|
|
return render_not_found if video.blank?
|
|
|
|
|
|
|
|
return render_error('该状态下不能删除视频') unless video.pending?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
video.destroy!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AliyunVod::Service.delete_video([video.uuid]) rescue nil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render_ok
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
|
|
def current_video
|
|
|
|
def current_video
|
|
|
|