diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 10aa39df2..dac213ff5 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -76,13 +76,19 @@ class ZipdownController < ApplicationController # Todo: User Access Controll homeattaches = bid.homeworks + #记录所有作业是不是有附件,有一个附件就改为true + has_file = false # 得到每一个人所有文件打包的zip文件 # 并将每一个人的zip打包为一个并返回路径 user_zip_paths = homeattaches.map do |homeattach| if homeattach.attachments.count > 0 zip_homework_by_user homeattach + has_file = true if has_file == false end end + + render_403 :message => :no_file_dowmload ,:layout => "course_base" if has_file == false + zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER #@paths = homeworks_attach_path