diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index d3d46b28d..e2df181f0 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -109,6 +109,9 @@ class AccountsController < ApplicationController set_autologin_cookie(user) UserAction.create(:action_id => user.try(:id), :action_type => "Login", :user_id => user.try(:id)) + + # 注册完成后有一天的试用申请 + UserDayCertification.create(user_id: user.id, status: 1) end def set_autologin_cookie(user) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 48ea8eb59..3bdd0d1b0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -147,6 +147,7 @@ class ApplicationController < ActionController::Base # 前端会捕捉401,弹登录弹框 # 未授权的捕捉407,弹试用申请弹框 def require_login + #6.13 -hs tip_exception(401, "..") unless User.current.logged? end @@ -182,7 +183,7 @@ class ApplicationController < ActionController::Base info_url = '/account/profile' tip_exception(402, info_url) elsif current_user.certification != 1 - day_cer = UserDayCertification.where(user_id: current_user.id).last + day_cer = UserDayCertification.find_by(user_id: current_user.id) unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 tip_exception(407, "系统未授权") end