From 5cf824022a36c4b27789b97d933efda877a9ee89 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 23 Jul 2019 12:12:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=88=E6=9D=83=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 33 +++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b0183574d..28fec46af 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -186,15 +186,32 @@ class ApplicationController < ActionController::Base # 系统全局认证 def check_auth - if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) - tip_exception(408, "您的试用申请正在审核中,请耐心等待") - elsif current_user.certification != 1 - day_cer = UserDayCertification.find_by(user_id: current_user.id) - tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 - elsif !current_user.profile_completed? - info_url = '/account/profile' - tip_exception(402, info_url) + day_cer = UserDayCertification.find_by(user_id: current_user.id) + # 如果注册超过24小时则需要完善资料及授权 + if (Time.now.to_i - day_cer.try(:created_at).to_i) > 86400 + if !current_user.profile_completed? + info_url = '/account/profile' + tip_exception(402, info_url) + elsif current_user.certification != 1 + if current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) + tip_exception(408, "您的试用申请正在审核中,请耐心等待") + end + tip_exception(407, "系统未授权") + end end + + + # if current_user.certification != 1 && current_user.apply_actions.exists?(container_type: 'TrialAuthorization', status: 0) + # tip_exception(408, "您的试用申请正在审核中,请耐心等待") + # elsif (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 + # if !current_user.profile_completed? + # info_url = '/account/profile' + # tip_exception(402, info_url) + # elsif current_user.certification != 1 + # day_cer = UserDayCertification.find_by(user_id: current_user.id) + # tip_exception(407, "系统未授权") unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 + # end + # end end def start_user_session(user)