Browse Source

短信ip限制2小时30次

pull/346/head
xxq250 1 year ago
parent
commit
8ccaedd3d1
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      app/services/info_risk_control_service.rb

+ 2
- 2
app/services/info_risk_control_service.rb View File

@@ -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



Loading…
Cancel
Save