コード例 #1
0
        /// <summary>
        ///     美容页面
        /// </summary>
        public ActionResult Beauty(string routerMainLinkDiscription, string linkUrl, string linkId, string noLinkId, int linkKind)
        {
            ViewBag.linkId   = linkId;
            ViewBag.noLinkId = noLinkId;
            ViewBag.linkKind = linkKind;
            var    valid         = false; //标志用于验证 是否应该解析
            string latter        = null;
            var    routerManager = new RouterManager();
            var    content       = routerManager.GetMainLink(routerMainLinkDiscription, linkKind).Content;

            if (linkUrl != "" && linkKind == 1)
            {
                //解析APP链接 参数拼接格式:/webView?url=xxx
                try
                {
                    var array = linkUrl.Split('?');
                    var cont  = array[0];
                    var url   = array[1].Split('=');
                    if (linkUrl.Length > linkUrl.IndexOf("=", StringComparison.Ordinal) + 1)
                    {
                        latter = linkUrl.Substring(linkUrl.IndexOf("=", StringComparison.Ordinal) + 1);
                    }
                    if (url[0] == "url" && cont == content)
                    {
                        valid = true;
                    }
                }
                catch (Exception)
                {
                    // ignored
                }
            }
            if (linkUrl != "" && linkKind == 2)
            //解析小程序链接 参数拼接格式:/pages /...
            {
                var cont = "/" + linkUrl.Split('/')[1];
                if (linkKind == 2 && cont == content)
                {
                    latter = linkUrl.Substring(6);
                    valid  = true;
                }
            }
            if (valid)
            {
                return(View(routerManager.GetParameterState(routerMainLinkDiscription,
                                                            latter, linkKind)));               //进入解析结果页面
            }
            return(View(routerManager.GetParameterList(routerMainLinkDiscription, linkKind))); //进入空白页面
        }
コード例 #2
0
        /// <summary>
        ///     发现文章页面
        /// </summary>
        public ActionResult Find(string routerMainLinkDiscription, string linkUrl, string linkId, string noLinkId, int linkKind)
        {
            ViewBag.linkId   = linkId;
            ViewBag.noLinkId = noLinkId;
            ViewBag.linkKind = linkKind;

            var valid         = false; //标志是否解析
            var routerManager = new RouterManager();
            var content       = routerManager.GetMainLink(routerMainLinkDiscription, linkKind).Content;
            var articleId     = "";

            if (linkUrl != "")
            {
                try
                {
                    var array   = linkUrl.Split('?');
                    var url     = array[1].Split('=');
                    var manager = new ArticleManager();

                    if (url[0] == "url" && array[0] == content && linkKind == 1)
                    {
                        valid = true;
                        var articleModel =
                            manager.GetByUrl(linkUrl.Substring(linkUrl.IndexOf("=", StringComparison.Ordinal) + 1));
                        if (articleModel != null)
                        {
                            articleId = articleModel.PKID.ToString();
                        }
                    }
                    if (array[1].Split('&')[0].Split('=')[0] == "id" && array[0] == content && linkKind == 2)
                    {
                        valid     = true;
                        articleId = array[1].Split('&')[0].Split('=')[1];
                    }
                }
                catch (Exception)
                {
                    // ignored
                }
            }
            if (valid)
            {
                return(View(routerManager.GetParameterState(routerMainLinkDiscription, articleId, linkKind))); //进入解析页面
            }
            return(View(routerManager.GetParameterList(routerMainLinkDiscription, linkKind)));                 //进入空白页面
        }
コード例 #3
0
        /// <summary>
        ///     保养页面
        /// </summary>
        public ActionResult Maintenance(string routerMainLinkDiscription, string linkUrl, string linkId,
                                        string noLinkId, int linkKind)
        {
            ViewBag.linkId   = linkId;
            ViewBag.noLinkId = noLinkId;
            ViewBag.linkKind = linkKind;

            var valid         = false; //标志是否解析
            var routerManager = new RouterManager();
            var content       = routerManager.GetMainLink(routerMainLinkDiscription, linkKind).Content;

            var list = new List <string>();
            var type = "";

            string[] aid;
            var      aId = "";

            if (linkKind == 1)
            {
                type = "type";
                aId  = "aid";
            }
            if (linkKind == 2)
            {
                type = "baoyangtypes";
                aId  = "actid";
            }
            if (linkUrl != "")
            {
                //解析格式APP/maintenance? type=xxx;xxx;xxx&aid=xxx&produceIds=xx,xx&productActivityId=xx&IsTuhuRecommend=x
                //小程序 /pages/keep_list2/keep_list2?baoyangtypes=xxx&actid=xxxx
                try
                {
                    var array       = linkUrl.Split('?');
                    var arrayLatter = array[1].Split('&');
                    ViewBag.paraArray = array[1]; //paraArray 是参数以&分隔的字符串

                    var typeString = arrayLatter[0].Split('=');
                    ViewBag.typeArray = typeString[1]; //typeArray 是种类以;分隔的字符串

                    if (typeString[0] == type && array[0] == content)
                    {
                        valid = true;
                    }

                    if (arrayLatter.Length >= 2)
                    {
                        aid = arrayLatter[1].Split('=');
                        if (aid[0] == aId)
                        {
                            ViewBag.aid = aid[1];
                            for (var i = 2; i < arrayLatter.Length; i++)
                            {
                                list.Add(arrayLatter[i]);
                            }
                        }
                        else
                        {
                            for (var i = 1; i < arrayLatter.Length; i++)
                            {
                                list.Add(arrayLatter[i]);
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    // ignored
                }
            }

            if (valid)
            {
                return(View(routerManager.GetParameterStateList(routerMainLinkDiscription, list, linkKind))); //进入解析页面
            }
            return(View(routerManager.GetParameterList(routerMainLinkDiscription, linkKind)));                //进入空白页面
        }
コード例 #4
0
        /// <summary>
        ///     H5页面
        /// </summary>
        public ActionResult HFive(string routerMainLinkDiscription, string linkUrl, string linkId, string noLinkId, int linkKind)
        {
            ViewBag.linkId   = linkId;
            ViewBag.noLinkId = noLinkId;
            ViewBag.linkKind = linkKind;
            var valid         = false; //标志是否解析
            var routerManager = new RouterManager();
            var content       = routerManager.GetMainLink(routerMainLinkDiscription, linkKind).Content;
            var list          = new List <string>();

            if (linkUrl != "")
            {
                var array = linkUrl.Split('?');
                if (content == array[0])
                {
                    valid = true;
                }

                if (linkKind == 1 && valid)
                {
                    try
                    {
                        ViewBag.paraArray = array[1]; //paraArray 是参数以&分隔的字符串

                        var arrayLatter = array[1].Split('&');
                        var url         = arrayLatter[0].Split('=');
                        ViewBag.url = url[1];

                        if (arrayLatter.Length >= 2)
                        {
                            var title = arrayLatter[1].Split('=');
                            if (title[0] == "title")
                            {
                                ViewBag.Pagetitle = title[1];
                                for (var i = 2; i < arrayLatter.Length; i++)
                                {
                                    list.Add(arrayLatter[i]);
                                }
                            }
                            else
                            {
                                for (var i = 1; i < arrayLatter.Length; i++)
                                {
                                    list.Add(arrayLatter[i]);
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        // ignored
                    }
                }
                if (linkKind == 2 && valid)
                {
                    var arrayLatter = array[1].Split('&');
                    var hash        = arrayLatter[0].Split('=');
                    ViewBag.hash = hash[1];
                }
            }

            if (valid)
            {
                return(View(routerManager.GetParameterStateList(routerMainLinkDiscription, list, linkKind))); //进入解析页面
            }
            return(View(routerManager.GetParameterList(routerMainLinkDiscription, linkKind)));                //进入空白页面
        }