|
|
|
@ -10,7 +10,7 @@ class ShixunsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
|
|
|
|
|
:propaedeutics, :departments, :apply_shixun_mirror,
|
|
|
|
|
:get_mirror_script, :download_file, :shixun_list]
|
|
|
|
|
:get_mirror_script, :download_file, :shixun_list, :batch_send_to_course]
|
|
|
|
|
|
|
|
|
|
before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns,
|
|
|
|
|
:propaedeutics, :departments, :apply_shixun_mirror,
|
|
|
|
@ -990,6 +990,16 @@ class ShixunsController < ApplicationController
|
|
|
|
|
CreateStudentWorkJob.perform_later(homework.id)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 批量发送
|
|
|
|
|
def batch_send_to_course
|
|
|
|
|
@course = Course.find_by!(id: params[:course_id])
|
|
|
|
|
shixuns = Shixun.where(id: params[:shixun_ids]).unhidden
|
|
|
|
|
shixuns.each do |shixun|
|
|
|
|
|
homework = HomeworksService.new.create_homework shixun, @course, nil, current_user
|
|
|
|
|
CreateStudentWorkJob.perform_later(homework.id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 二维码扫描下载
|
|
|
|
|
def download_file
|
|
|
|
|
file_path = params[:file_name]
|
|
|
|
|