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

This commit is contained in:
2024-12-24 15:11:55 +08:00
parent bdcd12fe74
commit c014857cf5

View File

@@ -692,7 +692,11 @@ class User < Owner
# Returns the user who matches the given autologin +key+ or nil
def self.try_to_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
end