|
|
@@ -1182,6 +1182,7 @@ class ApplicationController < ActionController::Base |
|
|
else |
|
|
else |
|
|
record_count = 1 |
|
|
record_count = 1 |
|
|
end |
|
|
end |
|
|
|
|
|
Rails.logger.info("请求太快,请稍后再试。#{controller_name}::#{request.remote_ip}") if record_count > 100 |
|
|
tip_exception("请求太快,请稍后再试。") if record_count > 100 |
|
|
tip_exception("请求太快,请稍后再试。") if record_count > 100 |
|
|
|
|
|
|
|
|
Rails.cache.write("request/#{controller_name}/#{Time.now.strftime('%Y%m%d%H')}/#{request.remote_ip}", record_count, expires_in: 1.hour) |
|
|
Rails.cache.write("request/#{controller_name}/#{Time.now.strftime('%Y%m%d%H')}/#{request.remote_ip}", record_count, expires_in: 1.hour) |
|
|
|