예제 #1
0
파일: AD.Simple.cs 프로젝트: jiaping/JPCMS
        /// <summary>
        /// 获取广告位的JS文件路径
        /// </summary>
        /// <param name="siteID">站点ID</param>
        /// <param name="url">站点Url</param>
        /// <param name="tag">页面标签</param>
        /// <returns></returns>
        public string GetADZoneJSPath(string siteID, string url, string app, string tag)
        {
            try
            {
                ChannelHelper chHelper = HelperFactory.GetHelper <ChannelHelper>();
                url = url.ToLower();
                string chID        = chHelper.GetChannelIDFromURL();
                string channelPath = chHelper.GetFullPath(chID);
                string pathType    = "";

                //路径类型:"*"首页与栏目;"*.html"内容页;"*.aspx"其他页
                if ((url.EndsWith("_") && !url.EndsWith("aspx_")) || url.EndsWith("_default.aspx") ||
                    url.EndsWith("_default.html") || url.EndsWith("_index.html"))
                {
                    pathType = "*";
                }

                if (url.EndsWith(".html") && !url.EndsWith("default.html"))
                {
                    pathType = "*.html";
                }

                if ((url.EndsWith(".aspx") && !url.EndsWith("default.aspx")) || url.EndsWith(".aspx_"))
                {
                    pathType    = "*.aspx";
                    channelPath = "";//如果为其他页,则此路径为空
                }
                return(GetADService().GetAdZoneJSPath(siteID, channelPath, pathType, tag));
            }
            catch (SoapException soapExt)
            {
                throw new Exception(We7Helper.SoapExceptionInfo(soapExt));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }