邮件配置问题

dev_sync_trustie
daiao 5 years ago
parent e14db79eb6
commit a67a9edfb0

@ -88,11 +88,11 @@ class ApplicationController < ActionController::Base
sigle_para = {email: value}
# 60s内不能重复发送
send_email_limit_cache_key = "send_email_60_second_limit:#{value}"
tip_exception(-2, '请勿频繁操作') if Rails.cache.exist?(send_email_limit_cache_key)
tip_exception(-1, '请勿频繁操作') if Rails.cache.exist?(send_email_limit_cache_key)
# 短时间内不能大量发送
send_email_control = LimitForbidControl::SendEmailCode.new(value)
tip_exception(-2, '邮件发送太频繁,请稍后再试') if send_email_control.forbid?
tip_exception(-1, '邮件发送太频繁,请稍后再试') if send_email_control.forbid?
begin
UserMailer.register_email(value, code).deliver_now

@ -31,7 +31,7 @@ class LimitForbidControl::Base
value = value.to_i + 1
# 锁定
if value > allow_times.to_i
if value >= allow_times.to_i
Rails.cache.write(forbid_cache_key, true, expires_in: forbid_expires)
Rails.cache.delete(cache_key)
else

Loading…
Cancel
Save