dev_course
SylorHuang 6 years ago
parent fb279178ae
commit 05d0bb7c1a

@ -21,7 +21,7 @@ class ZipsController < ApplicationController
file_name = filename_for_content_disposition(exercises.filename)
send_file exercises.ex_zip, filename: file_name, type: 'application/zip'
logger.info("##################_______________________file_name___________1100101010010__________###########")
Rails.logger.info("##################_______________________file_name___________1100101010010__________###########")
rescue Exception => e
normal_status(-1, e.message)

@ -41,13 +41,13 @@ class ExerciseUserPdfService
# aa = File.open(Rails.root.join("public/123.html"),"w+")
# aa.syswrite(kit.source)
#正式需删掉-------
logger.info("##################_______________________file_name___________5555555555__________###########")
Rails.logger.info("##################_______________________file_name___________5555555555__________###########")
file = Tempfile.new(filename)
logger.info("##################_______________________file_name___________66666666__________###########")
Rails.logger.info("##################_______________________file_name___________66666666__________###########")
kit.to_pdf(file.path)
logger.info("##################_______________________file_name___________7777777777__________###########")
Rails.logger.info("##################_______________________file_name___________7777777777__________###########")
file
end

@ -14,28 +14,28 @@ class ExportExercisesService
end
def ex_zip
logger.info("##################_______________________file_name___________11111__________###########")
Rails.logger.info("##################_______________________file_name___________11111__________###########")
zip_file = Tempfile.new(filename)
logger.info("##################_______________________file_name___________2222222__________###########")
Rails.logger.info("##################_______________________file_name___________2222222__________###########")
pdfs = []
Zip::File.open(zip_file.path, Zip::File::CREATE) do |zip|
logger.info("##################_______________________file_name___________3333333__________###########")
Rails.logger.info("##################_______________________file_name___________3333333__________###########")
ex_users.each do |ex_user|
export = ExerciseUserPdfService.new(exercise, ex_user)
logger.info("##################_______________________file_name___________444444__________###########")
Rails.logger.info("##################_______________________file_name___________444444__________###########")
pdf = export.ex_pdf
logger.info("##################_______________________file_name___________888888888__________###########")
Rails.logger.info("##################_______________________file_name___________888888888__________###########")
pdfs << pdf
logger.info("##################_______________________file_name___________999999999__________###########")
Rails.logger.info("##################_______________________file_name___________999999999__________###########")
begin
zip.add(export.filename, pdf.path)
logger.info("##################_______________________file_name___________10000000000000__________###########")
Rails.logger.info("##################_______________________file_name___________10000000000000__________###########")
rescue => ex
Rails.logger.error(ex.message)

Loading…
Cancel
Save