diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 1babd9bca..3c6bec6a6 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -29,6 +29,8 @@ class Api::V1::UsersController < Api::V1::BaseController tip_exception(-2,"邮件发送失败,请稍后重试") end ver_params = {code_type: code_type, code: verification_code, email: mail} + last_code = VerificationCode.where(code_type: code_type, email: mail).last + last_code.update_attributes!({created_at: Time.current - 10.minute}) if last_code.present? data = VerificationCode.new(ver_params) if data.save! render_ok