From 97b9148baa522125f7a421be8cd6474600724406 Mon Sep 17 00:00:00 2001 From: twt_2008 <422731884@qq.com> Date: Sat, 14 Dec 2024 14:18:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Admin.NET/Admin.NET.Core/S?= =?UTF-8?q?ervice/Tenant/SysTenantService.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin.NET.Core/Service/Tenant/SysTenantService.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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); } ///