diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs index f78fa4972..0976f20ae 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs @@ -28,12 +28,6 @@ namespace Learun.Application.Web.Areas.Permission.Controllers { return View(); } - - [HttpGet] - public ActionResult IndexForCount() - { - return View(); - } /// /// 表单页 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml index e1f4ef021..2bc115659 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml @@ -35,10 +35,14 @@
是否启用*
-
+
是否管理页*
+
+
是否手机端*
+
+
图片*
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.js index ef0fc852b..2db2690e2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.js @@ -30,6 +30,7 @@ var bootstrap = function ($, learun) { } $('#FEnabled').lrDataItemSelect({ code: 'YesOrNoBit' }); $('#FIsManagePage').lrDataItemSelect({ code: 'YesOrNoBit' }); + $('#FIsH5').lrDataItemSelect({ code: 'YesOrNoBit' }); $('#FImage').lrUploader(); }, initData: function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/TeacherIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/TeacherIndex.js index 1cbe5f30f..272709dac 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/TeacherIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/TeacherIndex.js @@ -97,6 +97,7 @@ var bootstrap = function ($, learun) { param = param || {}; param.FTId = FTId; param.UserId = UserId; + param.FIsH5 = 0; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj index b69a2d10c..3254b55ce 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj @@ -327,6 +327,14 @@ {88d8e99d-df26-4506-83c5-51e354818bef} Learun.Application.WorkFlow + + {975f2cb8-605c-4add-b365-b97bf844f0fe} + Learun.Cache.Base + + + {68902fcf-c439-4010-b17b-2499c972ee33} + Learun.Cache.Factory + {82069f3a-ab45-4f8b-b2bf-a36b14208f41} Learun.DataBase.Oracle 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 7ffade53d..b258582ec 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs @@ -11,6 +11,8 @@ using Learun.Application.OA; using System.Configuration; using Learun.Application.TwoDevelopment.Permission; using System; +using Learun.Cache.Base; +using Learun.Cache.Factory; namespace Learun.Application.WebApi.Modules { @@ -21,14 +23,73 @@ namespace Learun.Application.WebApi.Modules private Perm_FunctionTypeIBLL perm_FunctionTypeIBLL = new Perm_FunctionTypeBLL(); Perm_UserPermissionIBLL permUserPermissionIbll = new Perm_UserPermissionBLL(); private Perm_FunctionVisitIBLL functionVisitIbll = new Perm_FunctionVisitBLL(); + private ICache cache = CacheFactory.CaChe(); public SSOApi() : base("/quanjiang/sso") { Get["/list"] = GetList; + Get["/list20"] = GetList20; Get["/goto"] = GoTo; + Get["/goto20"] = GoToApplication; Get["first"] = First; Post["first"] = FirstPost; + Get["authorize"] = Authorize; + } + + /// + /// 统一身份认证2.0 + /// + /// + /// + public Response Authorize(dynamic _) + { + string appid = Request.Query["appid"]; + string secret = Request.Query["secret"]; + string appkey = Request.Query["appkey"]; + if (string.IsNullOrEmpty(appid)) + { + return Fail("参数:appid不能为空"); + } + if (string.IsNullOrEmpty(secret)) + { + return Fail("参数:secret不能为空"); + } + if (string.IsNullOrEmpty(appkey)) + { + return Fail("参数:appkey不能为空"); + } + var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); + if (application != null) + { + if (Util.DESEncrypt.Decrypt(application.FSecret, + ConfigurationManager.AppSettings["SSOPublicSecret"]).Equals(secret)) + { + try + { + var code = DESEncrypt.Decrypt(appkey, "bjqjsso"); + + if (!string.IsNullOrEmpty(cache.Read(code))) + { + return Success(new { useraccount = cache.Read(code) }); + } + else + { + return Fail("appkey已过期"); + } + } + catch (Exception e) + { + return Fail("appkey错误"); + } + } + else + { + return Fail("secret错误"); + } + } + else + return Fail("未授权的appid"); } private Response FirstPost(dynamic _) @@ -43,7 +104,7 @@ namespace Learun.Application.WebApi.Modules up.FId = ssoparam.FId; up.UserId = ssoparam.UserId; perm_FunctionIBLL.SaveEntityByUPId(ssoparam.UPId, up); - return Success(new{ FInterfaceUrl="/SSO/GoTo?sysid=" + DESEncrypt.Encrypt(up.FId, publickey) + "&openid=" + DESEncrypt.Encrypt(up.UserId, publickey)}); + return Success(new { FInterfaceUrl = "/SSO/GoTo?sysid=" + DESEncrypt.Encrypt(up.FId, publickey) + "&openid=" + DESEncrypt.Encrypt(up.UserId, publickey) }); } else { @@ -77,6 +138,39 @@ namespace Learun.Application.WebApi.Modules public string UserId { get; set; } public string UPUserName { get; set; } public string UPPass { get; set; } + public string appid { get; set; } + } + + public Response GoToApplication(dynamic _) + { + var userinfo = userInfo; + var ssoparam = this.GetReqData(); + if (userinfo != null) + { + var perm_application = perm_FunctionIBLL.GetPerm_FunctionEntity(ssoparam.appid); + if (perm_application != null) + { + //写入当前请求所登录的用户 + var code = Util.CommonHelper.RndNum(9); + cache.Write(code, userinfo.account, TimeSpan.FromMinutes(10)); + var url = perm_application.FInterfaceUrl; + if (url.Contains("?")) + { + url += "&appkey=" + DESEncrypt.Encrypt(code, "bjqjsso"); + } + else + { + url += "?appkey=" + DESEncrypt.Encrypt(code, "bjqjsso"); + } + return Success(new{ FInterfaceUrl=url }); + } + else + return Fail("appid解析失败,请确认。"); + } + else + { + return Fail("用户信息解析失败,请确认。"); + } } public Response GoTo(dynamic _) @@ -116,8 +210,9 @@ namespace Learun.Application.WebApi.Modules functionVisitEntity.PIsLoginSuccess = true; functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl; functionVisitIbll.SaveEntity(null, functionVisitEntity); - return Success(new { - FInterfaceUrl=perfun.FInterfaceUrl + "?u=" + + return Success(new + { + FInterfaceUrl = perfun.FInterfaceUrl + "?u=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPUserName, secretkey), publickey) + "&p=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPPass, secretkey), @@ -125,7 +220,8 @@ namespace Learun.Application.WebApi.Modules DESEncrypt.Encrypt( DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), secretkey), publickey) + "&ip=" + - DESEncrypt.Encrypt(DESEncrypt.Encrypt(GetIP(), secretkey), publickey)}); + DESEncrypt.Encrypt(DESEncrypt.Encrypt(GetIP(), secretkey), publickey) + }); } else { @@ -133,7 +229,7 @@ namespace Learun.Application.WebApi.Modules functionVisitEntity.PContent = "用户未配置转到用户名密码配置页面"; functionVisitIbll.SaveEntity(null, functionVisitEntity); //用户未配置转到用户名密码配置页面 - return Success(new{ FInterfaceUrl = "/SSO/FirstLogin?sysid=" + sysid + "&openid=" + openid}); + return Success(new { FInterfaceUrl = "/SSO/FirstLogin?sysid=" + sysid + "&openid=" + openid }); } } else @@ -151,7 +247,7 @@ namespace Learun.Application.WebApi.Modules functionVisitEntity.PIsLoginSuccess = true; functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl; functionVisitIbll.SaveEntity(null, functionVisitEntity); - return Success(new { FInterfaceUrl=perfun.FUrl}); + return Success(new { FInterfaceUrl = perfun.FUrl }); } else { @@ -168,6 +264,18 @@ namespace Learun.Application.WebApi.Modules } } + public Response GetList20(dynamic _) + { + var userinfo = userInfo; + var functionlist = perm_FunctionIBLL.GetListByUserId(userinfo.userId).Where(m=>m.FIsH5==true).Select(m=> + new + { + m.FName, + m.FId, + }); + return Success(functionlist); + } + /// /// 获取页面显示列表数据 @@ -181,7 +289,7 @@ namespace Learun.Application.WebApi.Modules var datatype = perm_FunctionTypeIBLL.GetListByUserId(userInfo.userId); foreach (var typeEntity in datatype) { - var datafunction = perm_FunctionIBLL.GetListByFTId(typeEntity.FTId, userInfo.userId); + var datafunction = perm_FunctionIBLL.GetListByFTId(typeEntity.FTId, userInfo.userId).Where(m=>m.FIsH5==true); foreach (var item in datafunction) { if (item.FIsManagePage == true) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_Function/Perm_FunctionEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_Function/Perm_FunctionEntity.cs index e65f43c53..cb7f3d371 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_Function/Perm_FunctionEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_Function/Perm_FunctionEntity.cs @@ -62,6 +62,11 @@ namespace Learun.Application.TwoDevelopment.Permission [Column("FISMANAGEPAGE")] public bool? FIsManagePage { get; set; } /// + /// 是否手机端 + /// + [Column("FISH5")] + public bool? FIsH5 { get; set; } + /// /// FEnabled /// [Column("FENABLED")]