修复: 代码溯源pdf只需下载一次
This commit is contained in:
parent
0364f81bb3
commit
6244a713ae
|
@ -69,12 +69,18 @@ class Traces::ProjectsController < Traces::BaseController
|
||||||
|
|
||||||
|
|
||||||
def task_pdf
|
def task_pdf
|
||||||
return render_error("task_id错误") if params[:task_id].blank?
|
task_id = params[:task_id]
|
||||||
result = Trace::PdfReportService.call(current_user.trace_token, params[:task_id])
|
return render_error("task_id错误") if task_id.blank?
|
||||||
if result.is_a?(Hash) && result[:code] == 200
|
file_save_path = "public/trace_task_results/#{task_id}/report.pdf"
|
||||||
redirect_to result[:download_url]
|
if File.exists?(file_save_path)
|
||||||
|
redirect_to "/trace_task_results/#{task_id}/report.pdf"
|
||||||
else
|
else
|
||||||
render_error("下载报告失败!")
|
result = Trace::PdfReportService.call(current_user.trace_token, task_id)
|
||||||
|
if result.is_a?(Hash) && result[:code] == 200
|
||||||
|
redirect_to result[:download_url]
|
||||||
|
else
|
||||||
|
render_error("下载报告失败!")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
rescue Exception => exception
|
rescue Exception => exception
|
||||||
puts exception.message
|
puts exception.message
|
||||||
|
|
Loading…
Reference in New Issue