Esempio n. 1
0
 /// <summary>
 /// 根据第三方应用系统编号、链接地址请求单点登录(加密)的链接地址
 /// 添加人:胡 耀 锋
 /// 添加时间:2014-04-17
 /// </summary>
 /// <hisotry>
 /// 修改描述:时间+作者+描述
 /// </hisotry>
 /// <param name="systemid">第三方应用系统编号</param>
 /// <param name="url">请求链接地址</param>
 /// <returns></returns>
 public JsonResult GetAppLinkUrl(string systemid, string url)
 {
     try
     {
         var linkUrl = url.Replace("&amp;", "&");
         if (!string.IsNullOrEmpty(systemid))
         {
             var attrValues =
                 new ComAttributeValueBll().GetSearchResult(new ComAttributeValueEntity()
             {
                 RsId        = systemid,
                 AttributeId = systemid == "00010001" ? 2 : 1
             });
             var attrUserLogin = new CrmUserMapBll().GetAllUserMaps(CurrentUser.CrmUser.Id, systemid);
             if (attrValues.Any() && attrUserLogin.Any())
             {
                 var parameter = attrUserLogin[0].LoginName + "|" + DateTime.Now.ToString(AppConst.DateFormatLong);
                 var md5Parm   = HttpUtility.UrlEncode(CommonMethod.Encrypt(parameter, AppConst.EncryptKey, AppConst.EncryptKey));
                 ////拼接URL
                 if (url.Contains("http://localhost"))
                 {
                     linkUrl = attrValues[0].Value + url.Substring(url.IndexOfAny(new char[] { '/' }, 0, 3));
                 }
                 else if (!url.Contains("http://") && systemid.Equals("00010001"))  //OA
                 {
                     linkUrl = attrValues[0].Value + url + "&uid=" + md5Parm;
                 }
                 else if (!url.Contains("http://") && systemid.Equals("00010003"))  //行政执法系统
                 {
                     linkUrl = attrValues[0].Value + url.Replace("../", "") + "&uid=" + md5Parm;
                 }
             }
         }
         var rtEntity = new StatusModel <DBNull>
         {
             rtData  = null,
             rtMsrg  = linkUrl,
             rtState = 0
         };
         return(Json(rtEntity, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 2
0
        public string GetUrl(string id, out int openFlag)
        {
            ComMenuEntity cm       = new ComMenuBll().GetMenuByID(id);
            string        systemid = cm.SystemId;
            string        url      = cm.MenuUrl;
            string        linkUrl  = cm.MenuUrl;

            if (!url.Equals(string.Empty))
            {
                if (!string.IsNullOrEmpty(systemid))
                {
                    //应用系统地址
                    var attrValues =
                        new ComAttributeValueBll().GetSearchResult(new ComAttributeValueEntity()
                    {
                        RsId        = systemid,
                        AttributeId = 1
                    });

                    var attrUserLogin = new CrmUserMapBll().GetAllUserMaps(CurrentUser.CrmUser.Id, systemid);

                    if (attrValues.Any() && attrUserLogin.Any())
                    {
                        var chqm      = url.IndexOf("?", StringComparison.Ordinal);
                        var parameter = attrUserLogin[0].LoginName + "|" + DateTime.Now.ToString(AppConst.DateFormatLong);
                        var md5Parm   = HttpUtility.UrlEncode(CommonMethod.Encrypt(parameter, AppConst.EncryptKey, AppConst.EncryptKey));

                        //拼接URL
                        linkUrl = attrValues[0].Value + url + (chqm == -1 ? "?" : "&") + "uid=" + md5Parm;
                    }
                }
                else
                {
                    linkUrl = "../" + url;
                }
            }
            openFlag = cm.OpenType;
            return(linkUrl);
        }