Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

chromesetting
杨树林 5 years ago
commit 19cace4096

@ -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]

@ -0,0 +1,4 @@
json.status 1
json.message "发送成功"
json.course_id @course.id
json.first_category_url module_url(@course.none_hidden_course_modules.first, @course)

@ -224,6 +224,7 @@ Rails.application.routes.draw do
post :apply_shixun_mirror
get :download_file
get :shixun_lists
post :batch_send_to_course
end
member do

Loading…
Cancel
Save