From 8424a7dc1f99bc69d9a02009fb5121a07c26ea4d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 13 Feb 2020 01:04:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/statistic_subject_info.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/statistic_subject_info.rake b/lib/tasks/statistic_subject_info.rake index c510c60fb..e7bf4116a 100644 --- a/lib/tasks/statistic_subject_info.rake +++ b/lib/tasks/statistic_subject_info.rake @@ -9,8 +9,8 @@ namespace :subjects do buffer_size = 0 column_value = "subject_id, study_count, course_study_count, initiative_study, passed_count, course_used_count, " + "school_used_count, created_at, updated_at" - subjects.find_in_batches(batch_size: 50) do |s, index| - Parallel.each_with_index(s, in_processes: 4) do |subject| + subjects.find_in_batches(batch_size: 50) do |s| + Parallel.each_with_index(s, in_processes: 4) do |subject, index| puts("---------------------data_statistic: #{subject.id}") Rails.logger.info("---------------------data_statistic: #{subject.id}") data = Subjects::DataStatisticService.new(subject) From 6b147fa5c3a133c63887dac3560b4980afbc908f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 13 Feb 2020 01:12:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 34 +++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1edd3bcf5..411481f0e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,23 +23,23 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign - # if !Rails.env.development? - # Rails.logger.info("66666 #{params}") - # # suffix = request.url.split(".").last.split("?").first - # # suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释 - # # unless suffix_arr.include?(suffix) - # if params[:client_key].present? - # randomcode = params[:randomcode] - # # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5) - # - # sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}") - # Rails.logger.info("2222 #{sign}") - # tip_exception(501, "请求不合理") if sign != params[:client_key] - # else - # tip_exception(501, "请求不合理") - # end - # # end - # end + if !Rails.env.development? + Rails.logger.info("66666 #{params}") + # suffix = request.url.split(".").last.split("?").first + # suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释 + # unless suffix_arr.include?(suffix) + if params[:client_key].present? + randomcode = params[:randomcode] + # tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5) + + sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}") + Rails.logger.info("2222 #{sign}") + tip_exception(501, "请求不合理") if sign != params[:client_key] + else + tip_exception(501, "请求不合理") + end + # end + end end # 全局配置参数