|
|
|
@@ -39,14 +39,14 @@ class InfoRiskControlService < ApplicationService |
|
|
|
def remote_ip_risk_control |
|
|
|
result = Rails.cache.read("InfoRiskControlService-RemoteIp-#{remote_ip}") |
|
|
|
if result.present? |
|
|
|
if result.to_i > 20 |
|
|
|
if result.to_i > 30 |
|
|
|
@status = 0 |
|
|
|
@message = "暂时无法请求,请稍后再试" |
|
|
|
else |
|
|
|
Rails.cache.write("InfoRiskControlService-RemoteIp-#{remote_ip}", result.to_i + 1) |
|
|
|
end |
|
|
|
else |
|
|
|
Rails.cache.write("InfoRiskControlService-RemoteIp-#{remote_ip}", 1, expires_in: 1.day) |
|
|
|
Rails.cache.write("InfoRiskControlService-RemoteIp-#{remote_ip}", 1, expires_in: 2.hours) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|