This commit is contained in:
parent
cc309355c6
commit
ad962e3e15
|
|
@ -120,7 +120,7 @@ namespace WGShare.API.Controllers.Frontend
|
||||||
|
|
||||||
result.ForEach(x =>
|
result.ForEach(x =>
|
||||||
{
|
{
|
||||||
x.IsManager = managerIds.Contains(x.Id);
|
x.IsManager = (x.RoleId == "1" || managerIds.Contains(x.Id));
|
||||||
var info = channelUsers.FirstOrDefault(q => q.UID == x.Id);
|
var info = channelUsers.FirstOrDefault(q => q.UID == x.Id);
|
||||||
if (info != null)
|
if (info != null)
|
||||||
{
|
{
|
||||||
|
|
@ -257,10 +257,16 @@ namespace WGShare.API.Controllers.Frontend
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
allUsers.ForEach(x => x.Value.EnableMicr = enableMicr);
|
allUsers.ForEach(x =>
|
||||||
|
{
|
||||||
|
if (x.Key != uid)
|
||||||
|
{
|
||||||
|
x.Value.EnableMicr = enableMicr;
|
||||||
|
}
|
||||||
|
});
|
||||||
RedisHelper.Instance.HMSet(RedisKeyConstant.SessionManage.GetChannelUserKey(TenantId, roomNum), allUsers);
|
RedisHelper.Instance.HMSet(RedisKeyConstant.SessionManage.GetChannelUserKey(TenantId, roomNum), allUsers);
|
||||||
|
|
||||||
await _hubContext.Clients.Group(roomNum).OperMicr(enableMicr);
|
await _hubContext.Clients.GroupExcept(roomNum, allUsers[uid].ConnectId).OperMicr(enableMicr);
|
||||||
await _hubContext.Clients.Group(roomNum).RefreshUserList();
|
await _hubContext.Clients.Group(roomNum).RefreshUserList();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -294,11 +300,19 @@ namespace WGShare.API.Controllers.Frontend
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
allUsers.ForEach(x => x.Value.EnableCamera = enableCamera);
|
allUsers.ForEach(x =>
|
||||||
|
{
|
||||||
|
if (x.Key != uid)
|
||||||
|
{
|
||||||
|
x.Value.EnableCamera = enableCamera;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//allUsers.ForEach(x => x.Value.EnableCamera = enableCamera);
|
||||||
RedisHelper.Instance.HMSet(RedisKeyConstant.SessionManage.GetChannelUserKey(TenantId, roomNum), allUsers);
|
RedisHelper.Instance.HMSet(RedisKeyConstant.SessionManage.GetChannelUserKey(TenantId, roomNum), allUsers);
|
||||||
|
|
||||||
// 全员开关闭摄像头
|
// 全员开关闭摄像头
|
||||||
await _hubContext.Clients.Group(roomNum).OperCamera(enableCamera);
|
await _hubContext.Clients.GroupExcept(roomNum, allUsers[uid].ConnectId).OperCamera(enableCamera);
|
||||||
await _hubContext.Clients.Group(roomNum).RefreshUserList();
|
await _hubContext.Clients.Group(roomNum).RefreshUserList();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -317,7 +331,16 @@ namespace WGShare.API.Controllers.Frontend
|
||||||
await _hubContext.Clients.Group(roomNum).RefreshUserList();
|
await _hubContext.Clients.Group(roomNum).RefreshUserList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 同步视图
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("sync-view")]
|
||||||
|
public async Task ChangeView([FromQuery] string roomNum, [FromQuery] string type)
|
||||||
|
{
|
||||||
|
await _hubContext.Clients.Groups(roomNum).RefreshView(type);
|
||||||
|
}
|
||||||
|
|
||||||
#region 文件分享
|
#region 文件分享
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using WGShare.API.Controllers.Basic;
|
using WGShare.API.Controllers.Basic;
|
||||||
|
using WGShare.API.Helpers;
|
||||||
|
using WGShare.Domain.Constant;
|
||||||
using WGShare.Domain.DTOs.User;
|
using WGShare.Domain.DTOs.User;
|
||||||
using WGShare.Domain.Entities;
|
using WGShare.Domain.Entities;
|
||||||
using WGShare.Domain.FriendlyException;
|
using WGShare.Domain.FriendlyException;
|
||||||
|
|
@ -29,14 +31,19 @@ namespace WGShare.API.Controllers.Frontend
|
||||||
/// <param name="pagedBaseDto">翻页信息</param>
|
/// <param name="pagedBaseDto">翻页信息</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("list")]
|
[HttpGet("list")]
|
||||||
public async Task<PagedResult<UserOutputDTO>> GetUserList([FromQuery] string? searchKeywod, [FromQuery] PagedBaseDto pagedBaseDto)
|
public async Task<PagedResult<UserOutputDTO>> GetUserList([FromQuery] string? searchKeywod, [FromQuery] bool? isOnline, [FromQuery] PagedBaseDto pagedBaseDto)
|
||||||
{
|
{
|
||||||
RefAsync<int> total = 0;
|
RefAsync<int> total = 0;
|
||||||
|
|
||||||
|
// 获取在线用户id
|
||||||
|
var onlineUid = RedisHelper.Instance.HKeys(RedisKeyConstant.SessionManage.GetOnlineUserKey(TenantId));
|
||||||
|
|
||||||
var list = await _sqlSugar.Queryable<User>()
|
var list = await _sqlSugar.Queryable<User>()
|
||||||
.InnerJoin<Role>((u, r) => u.RoleId == r.Id)
|
.InnerJoin<Role>((u, r) => u.RoleId == r.Id)
|
||||||
.Where((u, r) => u.IsDelete == false && u.TenantId == TenantId)
|
.Where((u, r) => u.IsDelete == false && u.TenantId == TenantId)
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(searchKeywod), (u, r) => u.UserName.Contains(searchKeywod) || u.Account.Contains(searchKeywod))
|
.WhereIF(!string.IsNullOrWhiteSpace(searchKeywod), (u, r) => u.UserName.Contains(searchKeywod) || u.Account.Contains(searchKeywod))
|
||||||
|
.WhereIF(isOnline.HasValue && isOnline.Value == true, (u, r) => onlineUid.Contains(u.Id))
|
||||||
|
.WhereIF(isOnline.HasValue && isOnline.Value == false, (u, r) => !onlineUid.Contains(u.Id))
|
||||||
.Select((u, r) => new UserOutputDTO
|
.Select((u, r) => new UserOutputDTO
|
||||||
{
|
{
|
||||||
Id = u.Id,
|
Id = u.Id,
|
||||||
|
|
@ -47,6 +54,9 @@ namespace WGShare.API.Controllers.Frontend
|
||||||
})
|
})
|
||||||
.ToPageListAsync(pagedBaseDto.PageIndex, pagedBaseDto.PageSize, total);
|
.ToPageListAsync(pagedBaseDto.PageIndex, pagedBaseDto.PageSize, total);
|
||||||
|
|
||||||
|
|
||||||
|
list.ForEach(x => x.IsOnline = onlineUid.Contains(x.Id));
|
||||||
|
|
||||||
return PagedResult<UserOutputDTO>.Create(list, total.Value);
|
return PagedResult<UserOutputDTO>.Create(list, total.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,17 @@
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task RefreshUserList();
|
Task RefreshUserList();
|
||||||
|
|
||||||
///// <summary>
|
/// <summary>
|
||||||
///// 客户端操作
|
/// 客户端操作
|
||||||
///// </summary>
|
/// </summary>
|
||||||
///// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
///// <returns></returns>
|
/// <returns></returns>
|
||||||
//Task Operation(int type);
|
Task Operation(int type);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新视图
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task RefreshView(string type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,15 +131,15 @@ namespace WGShare.API.Hubs
|
||||||
await Clients.GroupExcept(rooNum, Context.ConnectionId).ReceiveMessage(uid, uname, msg);
|
await Clients.GroupExcept(rooNum, Context.ConnectionId).ReceiveMessage(uid, uname, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
///// <summary>
|
/// <summary>
|
||||||
///// 发送客户端指令
|
/// 发送客户端指令
|
||||||
///// </summary>
|
/// </summary>
|
||||||
///// <returns></returns>
|
/// <returns></returns>
|
||||||
//[HubMethodName("sendOper")]
|
[HubMethodName("sendOper")]
|
||||||
//public async Task SendOperation(string roomNum, int type)
|
public async Task SendOperation(string roomNum, int type)
|
||||||
//{
|
{
|
||||||
// await Clients.Group(roomNum).Operation(type);
|
await Clients.Group(roomNum).Operation(type);
|
||||||
//}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@ using Hangfire;
|
||||||
using Hangfire.MemoryStorage;
|
using Hangfire.MemoryStorage;
|
||||||
using Masuit.Tools;
|
using Masuit.Tools;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using Microsoft.Extensions.FileSystemGlobbing.Internal;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using System.Linq;
|
||||||
using WGShare.API.BackgroudServices;
|
using WGShare.API.BackgroudServices;
|
||||||
using WGShare.API.Helpers;
|
using WGShare.API.Helpers;
|
||||||
using WGShare.API.Hubs;
|
using WGShare.API.Hubs;
|
||||||
|
|
@ -19,7 +21,9 @@ namespace WGShare.API
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
var configuration = builder.Configuration;
|
var configuration = builder.Configuration;
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
|
|
@ -30,6 +34,8 @@ namespace WGShare.API
|
||||||
Deserialize = (x, t) => JsonConvert.DeserializeObject(x, t),
|
Deserialize = (x, t) => JsonConvert.DeserializeObject(x, t),
|
||||||
//DeserializeRaw = (x, t) => JsonConvert.DeserializeObject(x, t),
|
//DeserializeRaw = (x, t) => JsonConvert.DeserializeObject(x, t),
|
||||||
});
|
});
|
||||||
|
ResetRedisKey();
|
||||||
|
|
||||||
builder.Services.AddControllers(options =>
|
builder.Services.AddControllers(options =>
|
||||||
{
|
{
|
||||||
// 全局异常捕获,无需在代码中 写 try catch
|
// 全局异常捕获,无需在代码中 写 try catch
|
||||||
|
|
@ -78,6 +84,7 @@ namespace WGShare.API
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
|
@ -103,5 +110,33 @@ namespace WGShare.API
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 程序启动前,删除redis中得数据
|
||||||
|
/// </summary>
|
||||||
|
private static void ResetRedisKey()
|
||||||
|
{
|
||||||
|
Console.WriteLine($@"程序开始前执行Redis清除操作开始...");
|
||||||
|
|
||||||
|
var keys = new List<string>();
|
||||||
|
long nextCursor = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
var scanResult = RedisHelper.Instance.Scan(nextCursor, "wgshare:*", 1000, "");
|
||||||
|
nextCursor = scanResult.cursor;
|
||||||
|
var items = scanResult.items;
|
||||||
|
keys.AddRange(items);
|
||||||
|
}
|
||||||
|
while (nextCursor != 0);
|
||||||
|
|
||||||
|
var keysArr = keys.ConvertAll(x => x.Replace("wgshare:", "")).Distinct().ToArray();
|
||||||
|
if (!keysArr.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
Console.WriteLine($@"删除键值:{Environment.NewLine}{string.Join(Environment.NewLine, keysArr)}");
|
||||||
|
RedisHelper.Instance.Del(keysArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("执行完毕,初始化Redis完成");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ namespace WGShare.API.ServiceConfigs
|
||||||
db.Aop.OnLogExecuting = (sql, pars) =>
|
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||||
{
|
{
|
||||||
// 打印 Sql 语句
|
// 打印 Sql 语句
|
||||||
Console.WriteLine($@"{new string('=', 10)}BEGIN{new string('=', 5)} DB-IP:{ipMatch.Value} {new string('=', 5)} DB-Name:{dbNamne} {new string('=', 15)}");
|
Console.WriteLine($@"{DateTime.Now.ToShortTimeString()}{new string('=', 10)}BEGIN{new string('=', 5)} DB-IP:{ipMatch.Value} {new string('=', 5)} DB-Name:{dbNamne} {new string('=', 15)}");
|
||||||
Console.WriteLine($"执行Sql:{Environment.NewLine}{sql}");
|
Console.WriteLine($"执行Sql:{Environment.NewLine}{sql}");
|
||||||
Console.WriteLine($"参数:{db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value))}");
|
Console.WriteLine($"参数:{db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value))}");
|
||||||
};
|
};
|
||||||
|
|
@ -53,7 +53,7 @@ namespace WGShare.API.ServiceConfigs
|
||||||
{
|
{
|
||||||
//执行完了可以输出SQL执行时间
|
//执行完了可以输出SQL执行时间
|
||||||
Console.WriteLine("Sql用时:" + db.Ado.SqlExecutionTime.ToString());
|
Console.WriteLine("Sql用时:" + db.Ado.SqlExecutionTime.ToString());
|
||||||
Console.WriteLine($@"{new string('=', 10)}END{new string('=', 7)} DB-IP:{ipMatch.Value} {new string('=', 5)} DB-Name:{dbNamne} {new string('=', 15)}");
|
Console.WriteLine($@"{DateTime.Now.ToShortTimeString()}{new string('=', 10)}END{new string('=', 7)} DB-IP:{ipMatch.Value} {new string('=', 5)} DB-Name:{dbNamne} {new string('=', 15)}");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,13 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WGShare.API.Controllers.Frontend.RoomController.ChangeView(System.String,System.String)">
|
||||||
|
<summary>
|
||||||
|
同步视图
|
||||||
|
</summary>
|
||||||
|
<param name="type"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:WGShare.API.Controllers.Frontend.RoomController.AddFile(WGShare.Domain.DTOs.File.ShareFileInputDTO)">
|
<member name="M:WGShare.API.Controllers.Frontend.RoomController.AddFile(WGShare.Domain.DTOs.File.ShareFileInputDTO)">
|
||||||
<summary>
|
<summary>
|
||||||
分享上传文件
|
分享上传文件
|
||||||
|
|
@ -178,7 +185,7 @@
|
||||||
<param name="fileId">文件Id</param>
|
<param name="fileId">文件Id</param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:WGShare.API.Controllers.Frontend.UserController.GetUserList(System.String,WGShare.Domain.GeneralModel.PagedBaseDto)">
|
<member name="M:WGShare.API.Controllers.Frontend.UserController.GetUserList(System.String,System.Nullable{System.Boolean},WGShare.Domain.GeneralModel.PagedBaseDto)">
|
||||||
<summary>
|
<summary>
|
||||||
获取用户列表
|
获取用户列表
|
||||||
</summary>
|
</summary>
|
||||||
|
|
@ -332,6 +339,19 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WGShare.API.Hubs.IMessageClient.Operation(System.Int32)">
|
||||||
|
<summary>
|
||||||
|
客户端操作
|
||||||
|
</summary>
|
||||||
|
<param name="type"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:WGShare.API.Hubs.IMessageClient.RefreshView(System.String)">
|
||||||
|
<summary>
|
||||||
|
更新视图
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:WGShare.API.Hubs.SessionManageHub.JoinChannel(System.String,System.Boolean,System.Boolean)">
|
<member name="M:WGShare.API.Hubs.SessionManageHub.JoinChannel(System.String,System.Boolean,System.Boolean)">
|
||||||
<summary>
|
<summary>
|
||||||
加入频道
|
加入频道
|
||||||
|
|
@ -353,6 +373,17 @@
|
||||||
<param name="rooNum"></param>
|
<param name="rooNum"></param>
|
||||||
<param name="msg"></param>
|
<param name="msg"></param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WGShare.API.Hubs.SessionManageHub.SendOperation(System.String,System.Int32)">
|
||||||
|
<summary>
|
||||||
|
发送客户端指令
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:WGShare.API.Program.ResetRedisKey">
|
||||||
|
<summary>
|
||||||
|
程序启动前,删除redis中得数据
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:WGShare.API.ServiceConfigs.AuthenticationServiceExtensions.AddAuth(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.String,System.String,System.String)">
|
<member name="M:WGShare.API.ServiceConfigs.AuthenticationServiceExtensions.AddAuth(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.String,System.String,System.String)">
|
||||||
<summary>
|
<summary>
|
||||||
添加认证和授权
|
添加认证和授权
|
||||||
|
|
|
||||||
|
|
@ -35,5 +35,10 @@ namespace WGShare.Domain.DTOs.User
|
||||||
/// 是否关闭摄像头
|
/// 是否关闭摄像头
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool EnableCamera { get; set; }
|
public bool EnableCamera { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否在线
|
||||||
|
/// </summary>
|
||||||
|
public bool IsOnline { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue