diff --git a/Admin.NET/Admin.NET.Core/Service/Tenant/SysTenantService.cs b/Admin.NET/Admin.NET.Core/Service/Tenant/SysTenantService.cs index bded12a0..f5bb5388 100644 --- a/Admin.NET/Admin.NET.Core/Service/Tenant/SysTenantService.cs +++ b/Admin.NET/Admin.NET.Core/Service/Tenant/SysTenantService.cs @@ -24,6 +24,7 @@ public class SysTenantService : IDynamicApiController, ITransient private readonly SysRoleMenuService _sysRoleMenuService; private readonly SysConfigService _sysConfigService; private readonly SysCacheService _sysCacheService; + private readonly IEventPublisher _eventPublisher; public SysTenantService(SqlSugarRepository sysTenantRep, SqlSugarRepository sysOrgRep, @@ -36,7 +37,8 @@ public class SysTenantService : IDynamicApiController, ITransient SysUserRoleService sysUserRoleService, SysRoleMenuService sysRoleMenuService, SysConfigService sysConfigService, - SysCacheService sysCacheService) + SysCacheService sysCacheService, + IEventPublisher eventPublisher) { _sysTenantRep = sysTenantRep; _sysOrgRep = sysOrgRep; @@ -50,6 +52,7 @@ public class SysTenantService : IDynamicApiController, ITransient _sysRoleMenuService = sysRoleMenuService; _sysConfigService = sysConfigService; _sysCacheService = sysCacheService; + _eventPublisher = eventPublisher; } /// @@ -254,6 +257,9 @@ public class SysTenantService : IDynamicApiController, ITransient 1310000000801 // 关于项目 }; await _sysRoleMenuService.GrantRoleMenu(new RoleMenuInput() { Id = newRole.Id, MenuIdList = menuIdList }); + + //发布新增租户事件 + await _eventPublisher.PublishAsync(CommonConst.InitTenant, tenant); } /// @@ -295,6 +301,9 @@ public class SysTenantService : IDynamicApiController, ITransient await _sysOrgRep.AsDeleteable().Where(u => u.TenantId == input.Id).ExecuteCommandAsync(); await _sysPosRep.AsDeleteable().Where(u => u.TenantId == input.Id).ExecuteCommandAsync(); + + //发布删除租户事件 + await _eventPublisher.PublishAsync(CommonConst.DeleteTenant, input); } ///