云库增加 AI识图,缓存,我的云库收藏增加安全标志
调用外部API 扣费
This commit is contained in:
1 parent
7c29e57623
commit
150e8644b7
49 files changed
+1069
-28
No files matched your search
@@ -131,6 +131,20 @@ public sealed class TokenService(IFreeSql db, IOptions<TokenAuthOptions> options
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>清理已撤销或已到期的会话,返回删除数量,供每日后台任务调用。</summary>
|
||||
public int CleanupExpiredTokens()
|
||||
{
|
||||
lock (Gate)
|
||||
{
|
||||
var now = Now;
|
||||
var cutoff = now.AddDays(-settings.AbsoluteMaxDays);
|
||||
// 与认证的到期边界一致;直接条件删除,避免先查询再删除时误删已续期的会话。
|
||||
return db.Delete<UserToken>()
|
||||
.Where(t => t.Revoked || t.ExpiresAt <= now || t.CreatedAt <= cutoff)
|
||||
.ExecuteAffrows();
|
||||
}
|
||||
}
|
||||
|
||||
internal void Revoke(string userName, string? sessionId = null)
|
||||
{
|
||||
lock (Gate)
|
||||
|
||||
Reference in new issue
Block a user