Merge branch 'develop' into standalone_develop

This commit is contained in:
2023-04-19 10:15:19 +08:00
4 changed files with 95 additions and 13 deletions

View File

@@ -112,12 +112,12 @@ class ApplicationController < ActionController::Base
# 邮箱类型的发送
sigle_para = {email: value}
# 60s内不能重复发送
send_email_limit_cache_key = "send_email_60_second_limit:#{value}"
tip_exception(-1, '请勿频繁操作') if Rails.cache.exist?(send_email_limit_cache_key)
# send_email_limit_cache_key = "send_email_60_second_limit:#{value}"
# tip_exception(-1, '请勿频繁操作') if Rails.cache.exist?(send_email_limit_cache_key)
# 短时间内不能大量发送
send_email_control = LimitForbidControl::SendEmailCode.new(value)
tip_exception(-1, '邮件发送太频繁,请稍后再试') if send_email_control.forbid?
# # 短时间内不能大量发送
# send_email_control = LimitForbidControl::SendEmailCode.new(value)
# tip_exception(-1, '邮件发送太频繁,请稍后再试') if send_email_control.forbid?
begin
if send_type == 3
UserMailer.find_password(value, code).deliver_now
@@ -126,8 +126,8 @@ class ApplicationController < ActionController::Base
else
UserMailer.register_email(value, code).deliver_now
end
Rails.cache.write(send_email_limit_cache_key, 1, expires_in: 1.minute)
send_email_control.increment!
# Rails.cache.write(send_email_limit_cache_key, 1, expires_in: 1.minute)
# send_email_control.increment!
# Mailer.run.email_register(code, value)
rescue Exception => e
logger_error(e)