fixed user 登录更新时间改为5分钟更新一次

This commit is contained in:
xxq250 2024-12-24 15:11:55 +08:00
parent bdcd12fe74
commit c014857cf5
1 changed files with 5 additions and 1 deletions

View File

@ -692,7 +692,11 @@ class User < Owner
# Returns the user who matches the given autologin +key+ or nil # Returns the user who matches the given autologin +key+ or nil
def self.try_to_autologin(key) def self.try_to_autologin(key)
user = Token.find_active_user('autologin', key) user = Token.find_active_user('autologin', key)
user.update(last_login_on: Time.now) if user if user
Rails.cache.fetch("user::update::last_login_on::#{user.id}",:expires_in => 5.minutes) do
user.update(last_login_on: Time.now)
end
end
user user
end end