短信ip限制2小时30次

This commit is contained in:
xxq250 2024-09-12 17:24:39 +08:00
parent 1026a5ea3d
commit 8ccaedd3d1
1 changed files with 2 additions and 2 deletions

View File

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