From b7c667fcbda5e4aaf6131bb5a19044b6bb364534 Mon Sep 17 00:00:00 2001 From: youngq Date: Tue, 10 Sep 2024 16:33:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=BE=E5=A4=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Frontend/RoomController.cs | 4 +- WGShare.API/Hubs/IMessageClient.cs | 19 +++++++++ WGShare.API/Hubs/SessionManageHub.cs | 35 ++++++++++++++++ WGShare.API/WGShare.API.xml | 41 +++++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) diff --git a/WGShare.API/Controllers/Frontend/RoomController.cs b/WGShare.API/Controllers/Frontend/RoomController.cs index 0b14d49..cf6423c 100644 --- a/WGShare.API/Controllers/Frontend/RoomController.cs +++ b/WGShare.API/Controllers/Frontend/RoomController.cs @@ -109,7 +109,7 @@ namespace WGShare.API.Controllers.Frontend RedisHelper.Instance.HSet(RedisKeyConstant.SessionManage.GetChannelShowUserKey(TenantId), inputDTO.RoomNum, showUser.UID); await _hubContext.Clients.Group(inputDTO.RoomNum).ShowUser(showUser.UID, showUser.UserName, string.Empty, string.Empty); } - + } await _hubContext.Clients.Group(inputDTO.RoomNum).ManagerRefresh(user, UId); @@ -567,7 +567,7 @@ namespace WGShare.API.Controllers.Frontend } } - + #region 文件分享 /// /// 分享上传文件 diff --git a/WGShare.API/Hubs/IMessageClient.cs b/WGShare.API/Hubs/IMessageClient.cs index ab64a12..29730f2 100644 --- a/WGShare.API/Hubs/IMessageClient.cs +++ b/WGShare.API/Hubs/IMessageClient.cs @@ -125,5 +125,24 @@ namespace WGShare.API.Hubs /// /// Task Watch(string[] watchUids); + + /// + /// 设备列表 + /// + Task DriverList(string callerUid); + + /// + /// 设置设备 + /// + /// + /// + Task SaveDriver(string driver); + + /// + /// 显示设备列表 + /// + /// + /// + Task ShowDriverList(string driversJsonString); } } diff --git a/WGShare.API/Hubs/SessionManageHub.cs b/WGShare.API/Hubs/SessionManageHub.cs index ca3f5d1..6d56080 100644 --- a/WGShare.API/Hubs/SessionManageHub.cs +++ b/WGShare.API/Hubs/SessionManageHub.cs @@ -168,5 +168,40 @@ namespace WGShare.API.Hubs await Clients.Group(roomNum).Operation(type); } + /// + /// 获取设备列表 + /// + /// + [HubMethodName("getDrivers")] + public async Task GetDriversList(string uid) + { + var callerUid = Context.User?.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; + + await Clients.User(uid).DriverList(callerUid); + } + + /// + /// 发送设备列表 + /// + /// + /// + /// + [HubMethodName("sendDrivers")] + public async Task SendDriversList(string uid, string driversJsonString) + { + await Clients.User(uid).ShowDriverList(driversJsonString); + } + + /// + /// 设置用户设备列表 + /// + /// + /// + /// + [HubMethodName("setDrivers")] + public async Task SetDriversList(string uid, string driversJsonString) + { + await Clients.User(uid).SaveDriver(driversJsonString); + } } } diff --git a/WGShare.API/WGShare.API.xml b/WGShare.API/WGShare.API.xml index c2db736..96244da 100644 --- a/WGShare.API/WGShare.API.xml +++ b/WGShare.API/WGShare.API.xml @@ -492,6 +492,25 @@ + + + 设备列表 + + + + + 设置设备 + + + + + + + 显示设备列表 + + + + 加入频道 @@ -519,6 +538,28 @@ + + + 获取设备列表 + + + + + + 发送设备列表 + + + + + + + + 设置用户设备列表 + + + + + 程序启动前,删除redis中得数据