pay_subject
cxt 5 years ago
parent 6586451c46
commit a4376c9aa3

@ -2,7 +2,7 @@ class LiveLinksController < ApplicationController
before_action :require_login before_action :require_login
before_action :find_course, only: [:index, :create] before_action :find_course, only: [:index, :create]
before_action :user_course_identity, :teacher_allowed, only: [:create] before_action :user_course_identity, :teacher_allowed, only: [:create]
before_action :edit_auth, only: [:edit, :update] before_action :edit_auth, only: [:edit, :update, :destroy]
def index def index
lives = @course.live_links lives = @course.live_links
@ -34,8 +34,6 @@ class LiveLinksController < ApplicationController
# 开启时发送消息,关闭直播时删除对应的消息 # 开启时发送消息,关闭直播时删除对应的消息
if params[:on_status].to_i == 1 if params[:on_status].to_i == 1
LivePublishJob.perform_later(current_live.id) LivePublishJob.perform_later(current_live.id)
else
current_live.tidings.destroy_all
end end
end end
else else
@ -44,6 +42,11 @@ class LiveLinksController < ApplicationController
render_ok render_ok
end end
def destroy
current_live.destroy!
render_ok
end
private private
def create_params def create_params

@ -550,7 +550,7 @@ Rails.application.routes.draw do
end end
end end
resources :live_links, only: [:index, :update, :create, :edit], shallow: true resources :live_links, only: [:index, :update, :create, :edit, :destroy], shallow: true
resources :homework_commons, shallow: true do resources :homework_commons, shallow: true do

Loading…
Cancel
Save