From 1ea980fe394527b18cf071373438db37b3a0f0d7 Mon Sep 17 00:00:00 2001 From: liujiaqiang <1448951783@qq.com> Date: Fri, 16 Jun 2023 15:44:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E7=AE=A1=E7=90=86=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=AD=97=E6=AE=B5=E8=B0=83=E6=95=B4=EF=BC=8Cwebsockt?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=BF=9E=E6=8E=A5=E6=88=90=E5=8A=9F=EF=BC=8C?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E4=BC=9A=E8=A7=81=E6=96=B0=E5=A2=9E=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 24Hour/Controllers/Common/RemoteController.cs | 7 +- .../Controllers/Common/WebSocketController.cs | 5 +- 24Hour/Controllers/LoginController.cs | 82 +++++++++++++++++++ .../system/SystemControllerController.cs | 27 ++++-- .../logs/Logs/ExceptionLog/20230616/14.log | 36 ++++++++ .../logs/Logs/ExceptionLog/20230616/15.log | 65 +++++++++++++++ Elight.Entity/AppMode/App_RemoteModel.cs | 7 +- .../SystemModel/App_Sys_MenuModel.cs | 21 ----- Elight.Logic/SystemModel/App_Sys_MenuInput.cs | 24 +----- 9 files changed, 218 insertions(+), 56 deletions(-) create mode 100644 24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230616/14.log create mode 100644 24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230616/15.log diff --git a/24Hour/Controllers/Common/RemoteController.cs b/24Hour/Controllers/Common/RemoteController.cs index 54a7109..0c1976e 100644 --- a/24Hour/Controllers/Common/RemoteController.cs +++ b/24Hour/Controllers/Common/RemoteController.cs @@ -17,17 +17,19 @@ namespace _24Hour.Controllers.Common public class RemoteController : Controller { #region Identity + private readonly IConfiguration _configuration; private readonly SqlSugarClient _db;//数据库 private readonly WriteSysLog _logs;//操作日志 App_Sys_UserModel _userdata = new App_Sys_UserModel();//当前用户 private readonly ILogger _logger;//日志 Result result = new Result(); - public RemoteController(ILogger logger, SqlSugarClient db, WriteSysLog logs, User user) + public RemoteController(ILogger logger, SqlSugarClient db, WriteSysLog logs, User user, IConfiguration configuration) { _logger = logger; _db = db; _logs = logs; _userdata = user.Userdata(); + _configuration = configuration; } #endregion @@ -51,7 +53,7 @@ namespace _24Hour.Controllers.Common .WhereIF(Remotedata.name != null, q => q.name.Contains(Remotedata.name)) .WhereIF(Remotedata.meetwitname != null, q => q.meetwitname.Contains(Remotedata.meetwitname)) .WhereIF(Remotedata.state != null, q => q.state == Remotedata.state) - .Where(q => q.IsDeleted == 0 && q.unitId == _userdata.unitCode).ToPageListAsync(Remotedata.PageIndex, Remotedata.PageSize); + .Where(q => q.IsDeleted == 0 && q.createuserId == _userdata.Id).ToPageListAsync(Remotedata.PageIndex, Remotedata.PageSize); var data = new QueryResult(Remotedata, list.OrderByDescending(q => q.creationtime).ToList()); result.IsSucceed = true; result.result = data; @@ -95,6 +97,7 @@ namespace _24Hour.Controllers.Common Remotedata.Id = Guid.NewGuid().ToString(); //Remotedata.unitId = _userdata.unitCode.ToString(); Remotedata.createuserId = _userdata.Id.ToString(); + Remotedata.appurl = $"{_configuration.GetSection("Videoaddress:rtmp").Value}{_userdata.Id}"; Remotedata.createusername = _userdata.name; var num = await _db.Insertable(Remotedata).ExecuteCommandAsync(); _db.CommitTran(); diff --git a/24Hour/Controllers/Common/WebSocketController.cs b/24Hour/Controllers/Common/WebSocketController.cs index 3fc8a01..0cc480b 100644 --- a/24Hour/Controllers/Common/WebSocketController.cs +++ b/24Hour/Controllers/Common/WebSocketController.cs @@ -2,6 +2,7 @@ using Elight.Logic; using Elight.Utility; using Elight.Utility.Code; +using Elight.Utility.Extensions; using javax.xml.crypto; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -272,7 +273,7 @@ namespace _24Hour.Controllers.Common #region 消息发送 var content = ""; //data.type等于1 为视频推送 - if (Senddata.typenum == "1" && Senddata.deviceno != "") + if (Senddata.typenum == "1" && Senddata.deviceno.NotNull()) { //设备发送给app Senddata.content = $"{_configuration.GetSection("Videoaddress:rtsp").Value}{Senddata.deviceno}"; @@ -349,7 +350,7 @@ namespace _24Hour.Controllers.Common /// /// /// - [HttpPost] + [HttpGet] [Route("close")] public async Task close() { diff --git a/24Hour/Controllers/LoginController.cs b/24Hour/Controllers/LoginController.cs index 927d003..022eebb 100644 --- a/24Hour/Controllers/LoginController.cs +++ b/24Hour/Controllers/LoginController.cs @@ -241,6 +241,88 @@ namespace _24Hour.Controllers ret.result = list; return ret; } + + /// + /// ȡ豸Ƶַ + /// + /// + /// + [HttpGet] + [Route("getrtsp")] + public async Task getrtsp() + { + ret.IsSucceed = true; + ret.result = $"{_configuration.GetSection("Videoaddress:rtsp").Value}"; + return ret; + } + + [HttpPost] + [Route("cardIdLogin")] + public async Task cardIdLogin(string cardId) + { + var date = await _db.Queryable().Where(q => q.IsDeleted == 0 && q.isdeactivate == 0 && q.cardId == cardId).FirstAsync(); + if (date != null) + { + if (date.usertype == 1 && date.audit == null) + { + ret.IsSucceed = false; + ret.Message = "ûУ"; + return ret; + } + else if (date.usertype == 1 && date.audit == 1) + { + ret.IsSucceed = false; + ret.Message = $"ûδͨԭ{date.describe}"; + return ret; + } + else if (date.usertype == 0 && date.becurrent == 1) + { + ret.IsSucceed = false; + ret.Message = $"ûδȨ޷¼ϵԱ"; + return ret; + } + #region jwttoken + var tokenHandler = new JwtSecurityTokenHandler(); + var claims = new Claim[] + { + new Claim(ClaimTypes.UserData,JsonConvert.SerializeObject(date)), + }; + + var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_configuration.GetSection("JwtConfiguration:Jwtkey").Value)); + var signingCredentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); + //Token + var jwttoken = new JwtSecurityToken( + issuer: _configuration.GetSection("JwtConfiguration:Issuer").Value, + audience: _configuration.GetSection("JwtConfiguration:Audience").Value, + claims: claims, + notBefore: DateTime.Now, + expires: DateTime.Now.AddDays(1), + signingCredentials: signingCredentials + ); + //var token = new JwtSecurityTokenHandler().CreateToken(jwttoken); + var tokenString = new JwtSecurityTokenHandler().WriteToken(jwttoken); + ret.result = new + { + name = date.name, + sex = date.sex, + phone = date.phone, + photo = date.photo, + duties = date.duties, + unitCode = "", + department = "", + token = tokenString + }; + #endregion + ret.IsSucceed = true; + } + else + { + ret.IsSucceed = false; + ret.Message = "ûδעᣡ"; + } + return ret; + } + } public class UserLogin { diff --git a/24Hour/Controllers/system/SystemControllerController.cs b/24Hour/Controllers/system/SystemControllerController.cs index 6ef5172..15b4687 100644 --- a/24Hour/Controllers/system/SystemControllerController.cs +++ b/24Hour/Controllers/system/SystemControllerController.cs @@ -4,6 +4,8 @@ using Elight.Logic.SystemModel; using Elight.Utility; using Elight.Utility.Code; using Elight.Utility.Extensions; +using Elight.Utility.logs; +using javax.xml.crypto; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SqlSugar; @@ -864,14 +866,23 @@ namespace _24Hour.Controllers.system [Route("QueryMenupage")] public async Task QueryMenupage(App_Sys_MenuInput Menudata) { - var totalCount = 0; - var list = await _db.Queryable() - .WhereIF(!Menudata.name.IsNull(), q => q.name.Contains(Menudata.name)) - .WhereIF(!Menudata.pid.IsNull(), q => q.pid.Contains(Menudata.pid)) - .Where(q => q.IsDelete == 0).ToPageListAsync(Menudata.PageIndex, Menudata.PageSize); - var data = new QueryResult(Menudata, list); - result.IsSucceed = true; - result.result = data; + try + { + var list = await _db.Queryable() + .WhereIF(!Menudata.name.IsNull(), q => q.name.Contains(Menudata.name)) + .WhereIF(!Menudata.pid.IsNull(), q => q.pid.Contains(Menudata.pid)) + .Where(q => q.IsDelete == 0).ToPageListAsync(Menudata.PageIndex, Menudata.PageSize); + var data = new QueryResult(Menudata, list.OrderByDescending(q => q.createtime).ToList()); + + result.IsSucceed = true; + result.result = data; + } + catch (Exception ex) + { + result.IsSucceed = false; + result.result = ex.Message; + LogService.WriteLog(ex, "菜单分页查询"); + } return result; } /// diff --git a/24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230616/14.log b/24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230616/14.log new file mode 100644 index 0000000..b0c9015 --- /dev/null +++ b/24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230616/14.log @@ -0,0 +1,36 @@ +日志时间:2023-06-16 14:50:26 +************************Exception Start******************************** +Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常 +Exception Date:2023/6/16 14:50:26 +Exception Type:MySqlConnector.MySqlException +Exception Message:Data too long for column 'OperatingManual' at row 1 +Exception Source:SqlSugar +Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters) + at SqlSugar.InsertableProvider`1.ExecuteCommand() + at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 52 +************************Exception End************************************ + +日志时间:2023-06-16 14:51:10 +************************Exception Start******************************** +Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常 +Exception Date:2023/6/16 14:51:10 +Exception Type:MySqlConnector.MySqlException +Exception Message:Data too long for column 'OperatingManual' at row 1 +Exception Source:SqlSugar +Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters) + at SqlSugar.InsertableProvider`1.ExecuteCommand() + at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 52 +************************Exception End************************************ + +日志时间:2023-06-16 14:52:29 +************************Exception Start******************************** +Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常 +Exception Date:2023/6/16 14:52:29 +Exception Type:MySqlConnector.MySqlException +Exception Message:Data too long for column 'OperatingManual' at row 1 +Exception Source:SqlSugar +Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters) + at SqlSugar.InsertableProvider`1.ExecuteCommand() + at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 52 +************************Exception End************************************ + diff --git a/24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230616/15.log b/24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230616/15.log new file mode 100644 index 0000000..f3ae4eb --- /dev/null +++ b/24Hour/wwwroot/CaseFile/logs/Logs/ExceptionLog/20230616/15.log @@ -0,0 +1,65 @@ +日志时间:2023-06-16 15:05:58 +************************Exception Start******************************** +Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常 +Exception Date:2023/6/16 15:05:58 +Exception Type:MySqlConnector.MySqlException +Exception Message:Data too long for column 'OperatingManual' at row 1 +Exception Source:SqlSugar +Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters) + at SqlSugar.InsertableProvider`1.ExecuteCommand() + at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 52 +************************Exception End************************************ + +日志时间:2023-06-16 15:11:52 +************************Exception Start******************************** +Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常 +Exception Date:2023/6/16 15:11:52 +Exception Type:MySqlConnector.MySqlException +Exception Message:Data too long for column 'OperatingManual' at row 1 +Exception Source:SqlSugar +Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters) + at SqlSugar.InsertableProvider`1.ExecuteCommand() + at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 52 +************************Exception End************************************ + +日志时间:2023-06-16 15:12:08 +************************Exception Start******************************** +Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常 +Exception Date:2023/6/16 15:12:08 +Exception Type:MySqlConnector.MySqlException +Exception Message:Data too long for column 'OperatingManual' at row 1 +Exception Source:SqlSugar +Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters) + at SqlSugar.InsertableProvider`1.ExecuteCommand() + at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 52 +************************Exception End************************************ + +日志时间:2023-06-16 15:38:09 +************************Exception Start******************************** +Exception Remark:菜单分页查询 +Exception Date:2023/6/16 15:38:09 +Exception Type:SqlSugar.SqlSugarException +Exception Message:中文提示 : Select 实体与表映射出错,可以注释实体类中的字段排查具体哪一个字段。【注意:如果用CodeFirt先配置禁止删列或更新】 Common Language Runtime detected an invalid program. +English Message : Entity mapping error.Common Language Runtime detected an invalid program. +Exception Source:SqlSugar +Exception StackTrace: at SqlSugar.Check.Exception(Boolean isException, String message, String[] args) + at SqlSugar.DbBindAccessory.GetEntityListAsync[T](SqlSugarProvider context, IDataReader dataReader) + at SqlSugar.DbBindProvider.DataReaderToListAsync[T](Type type, IDataReader dataReader) + at SqlSugar.QueryableProvider`1.GetDataAsync[TResult](Boolean isComplexModel, Type entityType, IDataReader dataReader) + at SqlSugar.QueryableProvider`1.GetDataAsync[TResult](KeyValuePair`2 sqlObj) + at SqlSugar.QueryableProvider`1._ToListAsync[TResult]() + at _24Hour.Controllers.system.SystemControllerController.QueryMenupage(App_Sys_MenuInput Menudata) in E:\Code\24Hour.Service\24Hour\Controllers\system\SystemControllerController.cs:line 871 +************************Exception End************************************ + +日志时间:2023-06-16 15:41:49 +************************Exception Start******************************** +Exception Remark:添加数据库日志信息_WriteSysLog_1 发生异常 +Exception Date:2023/6/16 15:41:49 +Exception Type:MySqlConnector.MySqlException +Exception Message:Data too long for column 'OperatingManual' at row 1 +Exception Source:SqlSugar +Exception StackTrace: at SqlSugar.AdoProvider.ExecuteCommand(String sql, SugarParameter[] parameters) + at SqlSugar.InsertableProvider`1.ExecuteCommand() + at Elight.Logic.WriteSysLog.WriteSysLogadd(String operationType, String content, Result result, SqlSugarClient _db, String opeCasDepAccCas) in E:\Code\24Hour.Service\Elight.Logic\WriteSysLog.cs:line 52 +************************Exception End************************************ + diff --git a/Elight.Entity/AppMode/App_RemoteModel.cs b/Elight.Entity/AppMode/App_RemoteModel.cs index 103395a..d6793b0 100644 --- a/Elight.Entity/AppMode/App_RemoteModel.cs +++ b/Elight.Entity/AppMode/App_RemoteModel.cs @@ -24,7 +24,12 @@ namespace Elight.Entity /// [DataMember] public string? unitId { get; set; } - + /// + /// 手机推流地址 + /// + [DataMember] + public string? appurl { get; set; } + /// /// 会议号 /// diff --git a/Elight.Entity/SystemModel/App_Sys_MenuModel.cs b/Elight.Entity/SystemModel/App_Sys_MenuModel.cs index ce680e0..fb6a383 100644 --- a/Elight.Entity/SystemModel/App_Sys_MenuModel.cs +++ b/Elight.Entity/SystemModel/App_Sys_MenuModel.cs @@ -54,33 +54,12 @@ namespace Elight.Entity [DataMember] public string? title { get; set; } - /// - /// 是否隐藏子菜单 - /// - [DataMember] - public bool hideChildrenInMenu { get; set; } - /// /// 图标 /// [DataMember] public string? icon { get; set; } /// - /// 当前菜单在列表中显示时 激活的菜单 - /// - [DataMember] - public bool? currentActiveMenu { get; set; } - /// - /// 是否隐藏面包眉 - /// - [DataMember] - public bool? hideBreadcrumb { get; set; } - /// - /// 是否隐藏当前菜单 - /// - [DataMember] - public bool? hideMenu { get; set; } - /// /// 排序 /// [DataMember] diff --git a/Elight.Logic/SystemModel/App_Sys_MenuInput.cs b/Elight.Logic/SystemModel/App_Sys_MenuInput.cs index 236297f..10c07c8 100644 --- a/Elight.Logic/SystemModel/App_Sys_MenuInput.cs +++ b/Elight.Logic/SystemModel/App_Sys_MenuInput.cs @@ -51,32 +51,12 @@ namespace Elight.Logic.SystemModel [DataMember] public string? title { get; set; } - /// - /// 是否隐藏子菜单 - /// - [DataMember] - public bool? hideChildrenInMenu { get; set; } - /// /// 图标 /// [DataMember] - public string icon { get; set; } - /// - /// 当前菜单在列表中显示时 激活的菜单 - /// - [DataMember] - public bool currentActiveMenu { get; set; } - /// - /// 是否隐藏面包眉 - /// - [DataMember] - public bool hideBreadcrum { get; set; } - /// - /// 是否隐藏当前菜单 - /// - [DataMember] - public bool hideMenu { get; set; } + public string? icon { get; set; } + /// /// 排序 ///