From 8a81871b6967c7603f0c2b2b7e1e4becb2a9d46b Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Thu, 15 Aug 2019 11:28:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=A9=BA=E7=99=BD=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E5=8F=8A=E5=AE=9E=E8=AE=AD=E6=8A=A5=E5=91=8A=E7=9A=84pdf?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- app/controllers/concerns/render_expand.rb | 2 +- app/controllers/exercises_controller.rb | 16 ++-------------- app/controllers/student_works_controller.rb | 2 +- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d17059231..e7b4bdac6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -239,7 +239,7 @@ class ApplicationController < ActionController::Base uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous")) if !User.current.logged? && Rails.env.development? - User.current = User.find 8686 + User.current = User.find 1 end diff --git a/app/controllers/concerns/render_expand.rb b/app/controllers/concerns/render_expand.rb index 4fd77c285..b0f26f43e 100644 --- a/app/controllers/concerns/render_expand.rb +++ b/app/controllers/concerns/render_expand.rb @@ -14,7 +14,7 @@ module RenderExpand kit.stylesheets << Rails.root.join('app/templates', path) end - send_data kit.to_pdf, filename: options[:filename], type: 'application/pdf' + send_data kit.to_pdf, filename: options[:filename], disposition: options[:disposition] || 'attachment', type: 'application/pdf' end end end \ No newline at end of file diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 44a2faa92..781ede214 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1290,20 +1290,8 @@ class ExercisesController < ApplicationController if params[:export].present? && params[:export] normal_status(0,"正在下载中") else - file = File.open(Rails.root.join('exercise_export/blank_exercise.html.erb')) - html = ERB.new(file.read) - - kit = PDFKit.new(html) - base_css = %w(app/templates/exercise_export/exercise_export.css) - base_css.each { |css| kit.stylesheets << Rails.root.join(css) } - # file = Tempfile.new(filename_) - # kit.to_pdf(file.path) - # file - - send_file kit.to_pdf, filename: filename_ ,disposition: 'inline', type:"application/pdf" - - # set_export_cookies - # render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets, disposition: 'inline', type:"pdf_attachment.content_type",stream:false + set_export_cookies + render pdf: 'exercise_export/blank_exercise', filename: filename_, stylesheets: stylesheets, disposition: 'inline', type:"pdf_attachment.content_type",stream:false end end diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 93f0fc586..670e4fb79 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -474,7 +474,7 @@ class StudentWorksController < ApplicationController filename_ = "#{@use&.student_id}_#{@use&.real_name}_#{@shixun&.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}" filename = Base64.urlsafe_encode64(filename_.strip) stylesheets = %w(shixun_work/shixun_work.css shared/codemirror.css) - render pdf: 'shixun_work/shixun_work', filename: filename, stylesheets: stylesheets + render pdf: 'shixun_work/shixun_work', filename: filename, stylesheets: stylesheets, disposition: 'inline', type:"pdf_attachment.content_type",stream:false end # 作品调分 From f1cf12a5f59f1af21f32889efed349bac645116b Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Thu, 15 Aug 2019 11:29:31 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=A9=BA=E7=99=BD=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E5=8F=8A=E5=AE=9E=E8=AE=AD=E6=8A=A5=E5=91=8Apdf=E7=9A=84?= =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/aliyun_vod.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 config/aliyun_vod.yml diff --git a/config/aliyun_vod.yml b/config/aliyun_vod.yml new file mode 100644 index 000000000..aa6547a62 --- /dev/null +++ b/config/aliyun_vod.yml @@ -0,0 +1,16 @@ +defaults: &defaults + access_key_id: 'test' + access_key_secret: 'test' + base_url: 'http://vod.cn-shanghai.aliyuncs.com' + cate_id: '-1' + callback_url: 'http://47.96.87.25:48080/api/callbacks/aliyun_vod.json' + signature_key: 'test12345678' + +development: + <<: *defaults + +test: + <<: *defaults + +production: + <<: *defaults \ No newline at end of file From c45a642be2055b688aab3ac077112d155ed049a9 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 15 Aug 2019 14:16:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9C=9F=E5=AE=9E=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_simple.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_simple.json.jbuilder b/app/views/users/_user_simple.json.jbuilder index 0d8f9d50c..3f9feebbe 100644 --- a/app/views/users/_user_simple.json.jbuilder +++ b/app/views/users/_user_simple.json.jbuilder @@ -1,4 +1,4 @@ json.id user.id -json.name user.full_name +json.name user.real_name json.login user.login json.image_url url_to_avatar(user) \ No newline at end of file