Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
jingquan huang 5 years ago
commit 28bc879f3b

@ -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)

@ -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

Loading…
Cancel
Save