示例#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)));                 //进入空白页面
        }