/// <summary> /// 获取模板页面 /// </summary> /// <param name="tempate"></param> /// <returns></returns> protected string getTemplate() { string html = null; this.ViewBag.parms = this.RouteData.DataTokens; #region 模板 string template = "index.cshtml"; //模板 object viewTemp = null; this.RouteData.Values.TryGetValue("view", out viewTemp); if (viewTemp != null) { template = viewTemp.ToString(); } bool isWap = false; var templatePath = string.Format("~/views/{0}/", this.config.Home); if (Fetch.isMobile() && this.config.EnabledWap) { if (Fetch.fileExist(Fetch.getMapPath(templatePath + template.Replace(".cshtml", ".mobile.cshtml")))) { template = template.Replace(".cshtml", ".mobile.cshtml"); isWap = true; } } templatePath += template; #endregion if (this.RouteData.Values.ContainsKey("cachetime")) { var cachetime = this.RouteData.Values["cachetime"]; int cache = (int)cachetime; if (cache > 0) { string cacheKey = Fetch.getRawUrl().ToLower(); html = TemplateCache.getCache(cacheKey, cache, isWap); if (html == null) { html = getHTML(templatePath); TemplateCache.setCache(cacheKey, html, cache, isWap); } } } if (html == null) { html = getHTML(templatePath); } return(html); }