From 06a377ba3646c19b2d5f05d14fb37de9c305ca62 Mon Sep 17 00:00:00 2001 From: dao Date: Thu, 16 Jan 2025 15:23:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E4=B8=8A=E5=8A=9E=E4=BA=8B=E5=A4=A7?= =?UTF-8?q?=E5=8E=85=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SSOSystemController.cs | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 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 404049e80..fc75f49da 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs @@ -18,6 +18,7 @@ using Learun.Cache.Factory; using Newtonsoft.Json; using Learun.Application.TwoDevelopment.LR_Desktop; using Learun.Application.TwoDevelopment.PersonnelManagement; +using Learun.Application.WeChat; namespace Learun.Application.Web.Controllers { @@ -58,7 +59,10 @@ namespace Learun.Application.Web.Controllers private StuConsumptionIBLL stuConsumptionIBLL = new StuConsumptionBLL(); private MealCardRunTabIBLL mealCardRunTabIBLL = new MealCardRunTabBLL(); private Sys_UpdateRecordIBLL sys_UpdateRecordIBLL = new Sys_UpdateRecordBLL(); - + /// + /// 标记登录的浏览器 + /// + private string LoginUserMarkKey = "Learun_ADMS_V7_Mark"; #region 统一身份认证3.0 /// /// 退出 @@ -951,6 +955,7 @@ namespace Learun.Application.Web.Controllers { try { + //var user = LoginUserInfo.Get(); string redi = Request.QueryString["redi"]; if (!string.IsNullOrEmpty(redi)) { @@ -966,6 +971,11 @@ namespace Learun.Application.Web.Controllers functionVisitEntity.PDate = DateTime.Now; functionVisitEntity.PUId = userid; var userinfo = userBll.GetEntityByUserId(userid); + var type = 0;//1学生 0教师 + if (userinfo.F_Description == "学生") + { + type = 1; + } functionVisitEntity.PUName = userinfo.F_RealName; if (uplist == null) { @@ -980,22 +990,37 @@ namespace Learun.Application.Web.Controllers { if (!string.IsNullOrEmpty(perfun.FInterfaceUrl)) { - if (!string.IsNullOrEmpty(perfun.UPUserName) && !string.IsNullOrEmpty(perfun.UPPass)) + var url = perfun.FUrl; + var token = OperatorHelper.Instance.AddLoginUser(userinfo.F_Account, "Learun_ADMS_6.1_PC", null);//写入缓存信息 + string loginMark = WebHelper.GetCookie(LoginUserMarkKey).ToString(); + if (url.Contains("?")) { - var user = LoginUserInfo.Get(); - functionVisitEntity.PIsLoginSuccess = true; - functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl; - functionVisitIbll.SaveEntity(null, functionVisitEntity); - return Redirect(perfun.FInterfaceUrl + "?u=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPUserName, secretkey), publickey) + "&p=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPPass, secretkey), publickey) + "&t=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), secretkey), publickey) + "&ip=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(GetIP(), secretkey), publickey)+"&m=" + DESEncrypt.Encrypt(user.loginMark) + "&t=" + DESEncrypt.Encrypt(user.token)); + url += "&appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perfun.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userinfo.F_RealName, Util.DESEncrypt.Decrypt(perfun.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userinfo.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perfun.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userinfo.F_EnCode, Util.DESEncrypt.Decrypt(perfun.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); } else { - functionVisitEntity.PIsLoginSuccess = false; - functionVisitEntity.PContent = "用户未配置转到用户名密码配置页面"; - functionVisitIbll.SaveEntity(null, functionVisitEntity); - //用户未配置转到用户名密码配置页面 - return Redirect("/SSOSystem/FirstLogin?sysid=" + sysid + "&openid=" + openid); + url += "?appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perfun.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userinfo.F_RealName, Util.DESEncrypt.Decrypt(perfun.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userinfo.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perfun.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userinfo.F_EnCode, Util.DESEncrypt.Decrypt(perfun.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); } + return Redirect(url); + + + //if (!string.IsNullOrEmpty(perfun.UPUserName) && !string.IsNullOrEmpty(perfun.UPPass)) + //{ + // var token = OperatorHelper.Instance.AddLoginUser(userinfo.F_Account, "Learun_ADMS_6.1_PC", null);//写入缓存信息 + // string loginMark = WebHelper.GetCookie(LoginUserMarkKey).ToString(); + // functionVisitEntity.PIsLoginSuccess = true; + // functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl; + // functionVisitIbll.SaveEntity(null, functionVisitEntity); + // //return Redirect(perfun.FInterfaceUrl + "?u=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPUserName, secretkey), publickey) + "&p=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPPass, secretkey), publickey) + "&t=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), secretkey), publickey) + "&ip=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(GetIP(), secretkey), publickey)+"&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token)); + //} + //else + //{ + // functionVisitEntity.PIsLoginSuccess = false; + // functionVisitEntity.PContent = "用户未配置转到用户名密码配置页面"; + // functionVisitIbll.SaveEntity(null, functionVisitEntity); + // //用户未配置转到用户名密码配置页面 + // return Redirect("/SSOSystem/FirstLogin?sysid=" + sysid + "&openid=" + openid); + //} } else {