This commit is contained in:
alex
2023-09-18 14:06:43 +08:00
parent 1cefb51aa9
commit 64b6a5485c
3 changed files with 18 additions and 17 deletions

View File

@@ -289,18 +289,15 @@ public class OAuthService : IDynamicApiController, ITransient
{
if (type.IsNullOrEmpty()) type = "Web"; // 默认为Web端菜单目录
var userId = _userManager.UserId;
//modify by ly on 20230918 登录成功后启动定时服务
if (!userId.IsNullOrWhiteSpace())
{
var isStartedProperty = _backgroundService.GetType().GetProperty("IsStarted");
if (isStartedProperty?.GetValue(_backgroundService) is bool isStarted && !isStarted)
{
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
await _backgroundService.StartAsync(cancellationTokenSource.Token);
await _backgroundService.StartAsync(CancellationToken.None);
}
}
@@ -405,12 +402,8 @@ public class OAuthService : IDynamicApiController, ITransient
[HttpGet("Logout")]
public async Task Logout([FromQuery] string ticket)
{
//await _cacheManager.DelAsync("AsscessToken");
//modify by ly on 20230918
var isStartedProperty = _backgroundService.GetType().GetProperty("IsStarted");
isStartedProperty?.SetValue(_backgroundService, false);
await _backgroundService.StopAsync(CancellationToken.None);
UserManager.AsscessToken = string.Empty;