用户登录、登出通知Wms定时服务的启动预关闭

This commit is contained in:
alex
2023-08-04 10:10:23 +08:00
parent b3087b8f64
commit b5916b4c0e
5 changed files with 41 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ using JNPF.Common.Core.Handlers;
using JNPF.Message.Interfaces.Message;
using JNPF.Extras.DatabaseAccessor.SqlSugar.Models;
using Aop.Api.Domain;
using Tnb.WarehouseMgr;
namespace JNPF.OAuth;
@@ -382,6 +383,10 @@ public class OAuthService : IDynamicApiController, ITransient
[HttpGet("Logout")]
public async Task Logout([FromQuery] string ticket)
{
//用户退出时停止Wms定时任务 modify by ly on 20230804
var conditionalBackgroundService = App.GetRequiredService<ConditionalBackgroundService>();
await conditionalBackgroundService.StopAsync(CancellationToken.None);
var tenantId = _userManager.TenantId ?? "default";
var userId = _userManager.UserId ?? "admim";
var httpContext = _httpContextAccessor.HttpContext;
@@ -672,6 +677,10 @@ public class OAuthService : IDynamicApiController, ITransient
}
}
//启动Wms定时服务 modify by ly on 20230804
var conditionalBackgroundService = App.GetRequiredService<ConditionalBackgroundService>();
await conditionalBackgroundService.StartAsync(CancellationToken.None);
return new
{
theme = user.Theme == null ? "classic" : user.Theme,

View File

@@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\..\common\Tnb.Common.Core\Tnb.Common.Core.csproj" />
<ProjectReference Include="..\..\message\Tnb.Message.Interfaces\Tnb.Message.Interfaces.csproj" />
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr\Tnb.WarehouseMgr.csproj" />
<ProjectReference Include="..\Tnb.Systems.Interfaces\Tnb.Systems.Interfaces.csproj" />
</ItemGroup>