From 05c67f3c6ef7d1281739a520b68b9cb36dac819a Mon Sep 17 00:00:00 2001 From: zzj <31836194@qq.com> Date: Tue, 9 Jan 2024 09:05:03 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=97=A5=E5=BF=97=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Learun.Util/Learun.Util.csproj | 2 ++ .../Learun.Util/Learun.Util/Log/LogHelper.cs | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj index 78ebc041b..628f27c2b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Learun.Util.csproj @@ -95,6 +95,7 @@ + @@ -154,6 +155,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs new file mode 100644 index 000000000..6261c1c0d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs @@ -0,0 +1,33 @@ +using System; +using System.IO; + +namespace Learun.Util.Log +{ + public class LogHelper + { + public static void Info(string msg) + { + try + { + #region log + //文件路径 + string path = Path.Combine(Directory.GetCurrentDirectory(), "logs"); + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + + //文件 + string fileName = Path.Combine(path, $"{DateTime.Now:yyyyMMdd}.log"); + string message = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} logInfo:{msg}。{Environment.NewLine}"; + File.AppendAllText(fileName, message); + #endregion + } + catch + { + + + } + } + } +} From 10f249c6ab0272cc5e14134726a442041ad0296f Mon Sep 17 00:00:00 2001 From: dao Date: Tue, 22 Oct 2024 10:10:15 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 996b47404..9afde2bcb 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,4 @@ Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js /Learun.Framework.Ultimate V7/LearunApp-2.2.0/.hbuilderx/launch.json /Learun.Framework.Ultimate V7/Learun.Application.Web/Properties/PublishProfiles /Learun.Framework.Ultimate V7/Learun.Application.Web/Content/images/QRCode +/Learun.Framework.Ultimate V7/Learun.Application.WebApi/logs/20241022.log From 96b1f917c44e72badc4db73faae6c9a00bc9bf22 Mon Sep 17 00:00:00 2001 From: dao Date: Tue, 22 Oct 2024 10:10:20 +0800 Subject: [PATCH 3/6] --- .gitignore | 2 +- .../Learun.Util/Learun.Util/Log/LogHelper.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9afde2bcb..84ba09487 100644 --- a/.gitignore +++ b/.gitignore @@ -82,4 +82,4 @@ Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js /Learun.Framework.Ultimate V7/LearunApp-2.2.0/.hbuilderx/launch.json /Learun.Framework.Ultimate V7/Learun.Application.Web/Properties/PublishProfiles /Learun.Framework.Ultimate V7/Learun.Application.Web/Content/images/QRCode -/Learun.Framework.Ultimate V7/Learun.Application.WebApi/logs/20241022.log +/Learun.Framework.Ultimate V7/Learun.Application.WebApi/logs/ diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs index 6261c1c0d..f9a68a245 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Log/LogHelper.cs @@ -11,7 +11,7 @@ namespace Learun.Util.Log { #region log //文件路径 - string path = Path.Combine(Directory.GetCurrentDirectory(), "logs"); + string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); From dd05406f49558b586a0cc84f373dc066e1085c8e Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Tue, 29 Oct 2024 10:20:42 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E8=AE=A4=E8=AF=813.0=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SSOSystemController.cs | 6 +++--- .../Learun.Application.WebApi/Modules/SSOApi.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs index e63133638..404049e80 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs @@ -90,7 +90,7 @@ namespace Learun.Application.Web.Controllers var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); if (application != null) { - if (Md5Helper.Encrypt(application.FSecret, 32) == appkey) + if (Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) == appkey) { OperatorHelper.Instance.EmptyCurrent(DESEncrypt.Decrypt(t), DESEncrypt.Decrypt(m)); return SuccessString("true"); @@ -132,7 +132,7 @@ namespace Learun.Application.Web.Controllers var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); if (application != null) { - if (Md5Helper.Encrypt(application.FSecret, 32) == appkey) + if (Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) == appkey) { OperatorResult res = OperatorHelper.Instance.IsOnLine(DESEncrypt.Decrypt(t), DESEncrypt.Decrypt(m)); if (res.stateCode == 1) @@ -182,7 +182,7 @@ namespace Learun.Application.Web.Controllers var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); if (application != null) { - if (Md5Helper.Encrypt(application.FSecret, 32) == appkey) + if (Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) == appkey) { OperatorResult res = OperatorHelper.Instance.IsOnLine(DESEncrypt.Decrypt(t), DESEncrypt.Decrypt(m)); if (res.stateCode == 1) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs index 3cb92ac98..59f1c1d12 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs @@ -71,7 +71,7 @@ namespace Learun.Application.WebApi.Modules var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); if (application != null) { - if (Md5Helper.Encrypt(application.FSecret, 32) == appkey) + if (Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) == appkey) { OperatorHelper.Instance.EmptyCurrent(DESEncrypt.Decrypt(t), DESEncrypt.Decrypt(m)); return SuccessString("true"); @@ -114,7 +114,7 @@ namespace Learun.Application.WebApi.Modules var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); if (application != null) { - if (Md5Helper.Encrypt(application.FSecret, 32) == appkey) + if (Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) == appkey) { OperatorResult res = OperatorHelper.Instance.IsOnLine(DESEncrypt.Decrypt(t), DESEncrypt.Decrypt(m)); if (res.stateCode == 1) From 823c2f0be6a7a9b22b0ba4685aa2e10231b56af4 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Tue, 29 Oct 2024 10:20:56 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=95=99=E5=B8=88=E7=94=A8=E6=88=B7=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Learun.Application.WebApi/Modules/Arrangelesson.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs index 4ed103990..b3482d268 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Arrangelesson.cs @@ -44,6 +44,7 @@ namespace Learun.Application.WebApi.Modules Get["/allschool"] = GetAllSchools; Get["/allclasslesson"] = GetAllClassLesson; Get["/allelelectivelesson"] = GetAllElectiveLesson; + Get["/allteacheruser"] = GetAllTeachersUsers; //以下接口不往ArrangeLessonSync里记录已传数据 Get["/schoolNotRecord"] = GetSchoolsNotRecord; @@ -115,6 +116,11 @@ namespace Learun.Application.WebApi.Modules var result = empInfoIbll.GetAllList().Where(m => m.CheckMark == true).ToList(); return Success(result); } + private Response GetAllTeachersUsers(dynamic _) + { + var result = userIbll.GetAllList().Where(m => m.F_DeleteMark == 0 && m.F_EnabledMark == 1 && m.F_Description == "教师").ToList(); + return Success(result); + } private Response GetAllSchools(dynamic _) { var result = companyIbll.GetList(); From 4d98f53e81689b67085b6a3daffbec8f6318c328 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 30 Oct 2024 14:17:07 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E8=AE=A4=E8=AF=81=E7=99=BB=E5=BD=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LoginController.cs | 68 +++++++++++-------- .../Learun.Util/Security/DESEncrypt.cs | 2 +- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs index 0ef30f336..be6d6c793 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs @@ -666,39 +666,51 @@ namespace Learun.Application.Web.Controllers //修改用户的允许登录结束时间; userBll.UpdateAllowEndTime(userEntity.F_UserId, 0); - if (!Returnurl.IsEmpty() && !appid.IsEmpty()) + try { - var perm_application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); - if (perm_application != null) + if (!Returnurl.IsEmpty() && !appid.IsEmpty()) { - //var userinfo = LoginUserInfo.Get(); - //写入当前请求所登录的用户 - var type = 0;//1学生 0教师 - if (userEntity.F_Description == "学生") + var perm_application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); + if (perm_application != null) { - type = 1; - } - var url = HttpUtility.UrlDecode(Returnurl); - if (url.Contains("?")) - { - url += "&appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userEntity.F_EnCode, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); - } - else - { - url += "?appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userEntity.F_EnCode, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); + //var userinfo = LoginUserInfo.Get(); + //写入当前请求所登录的用户 + var type = 0;//1学生 0教师 + if (userEntity.F_Description == "学生") + { + type = 1; + } + var url = HttpUtility.UrlDecode(Returnurl); + if (url.Contains("?")) + { + url += "&appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userEntity.F_EnCode, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); + } + else + { + url += "?appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userEntity.F_EnCode, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); + } + Returnurl = url; } - Returnurl = url; + Perm_FunctionVisitEntity functionVisitEntity = new Perm_FunctionVisitEntity(); + functionVisitEntity.Create(); + functionVisitEntity.Fid = perm_application.FId; + functionVisitEntity.PDate = DateTime.Now; + functionVisitEntity.PUId = userEntity.F_UserId; + functionVisitEntity.PUName = userEntity.F_RealName; + functionVisitEntity.PIsLoginSuccess = true; + functionVisitEntity.PContent = "成功跳转到:" + Returnurl; + functionVisitIbll.SaveEntity(null, functionVisitEntity); + return Success("登录成功", new { FInterfaceUrl = Returnurl }); } - Perm_FunctionVisitEntity functionVisitEntity = new Perm_FunctionVisitEntity(); - functionVisitEntity.Create(); - functionVisitEntity.Fid = perm_application.FId; - functionVisitEntity.PDate = DateTime.Now; - functionVisitEntity.PUId = userEntity.F_UserId; - functionVisitEntity.PUName = userEntity.F_RealName; - functionVisitEntity.PIsLoginSuccess = true; - functionVisitEntity.PContent = "成功跳转到:" + Returnurl; - functionVisitIbll.SaveEntity(null, functionVisitEntity); - return Success("登录成功", new { FInterfaceUrl = Returnurl }); + + } + catch (Exception ex) + { + logEntity.F_ExecuteResult = 0; + logEntity.F_ExecuteResultJson = "跳转失败:" + ex; + logEntity.F_SourceContentJson = "Returnurl:" + Returnurl + " appid:" + appid; + logEntity.WriteLog(); + return Fail("跳转失败"); } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs index 0c5b61091..15c18a95e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs @@ -42,7 +42,7 @@ namespace Learun.Util } DESCryptoServiceProvider des = new DESCryptoServiceProvider(); byte[] inputByteArray; - inputByteArray = Encoding.Default.GetBytes(Text); + inputByteArray = Encoding.Default.GetBytes(Text ?? ""); des.Key = ASCIIEncoding.ASCII.GetBytes(key); des.IV = ASCIIEncoding.ASCII.GetBytes(iv); System.IO.MemoryStream ms = new System.IO.MemoryStream();