override protected void OnInit(EventArgs e) { base.OnInit(e); if (errInitTemplates != "") { Response.Write(errInitTemplates); return; } //1获得模版基本信息 BLL.wx_templates tBll = new BLL.wx_templates(); string templateErJiFileName = tBll.GetErJiTemplatesFileNameByWid(wid); if (templateErJiFileName == null || templateErJiFileName.Trim() == "") { tPath = MyCommFun.GetRootPath() + "/templates/category/albums/category.html"; } else { tPath = MyCommFun.GetRootPath() + "/templates/category/" + templateErJiFileName + "/category.html"; } MyCommFun.RequestWid(); MyCommFun.getTotalUrl(); TemplateMgr template = new TemplateMgr(tPath, wid); template.tType = TemplateType.Channel; template.openid = MyCommFun.RequestOpenid(); template.OutPutHtml(templateErJiFileName, wid); }
override protected void OnInit(EventArgs e) { base.OnInit(e); if (errInitTemplates != "") { Response.Write(errInitTemplates); return; } //1获得模版基本信息 BLL.wx_module_templates tBll = new BLL.wx_module_templates(); templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid); if (templateFileName == null || templateFileName.Trim() == "") { errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!"; Response.Write(errInitTemplates); Response.End(); return; } BLL.wx_userweixin bll = new BLL.wx_userweixin(); Model.wx_userweixin wxModel = bll.GetModel(wid); string thisUrl = MyCommFun.getTotalUrl(); OAuth2BaseProc(wxModel, "cart", thisUrl); serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/category.html"; ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid); template.tType = TemplateType.Index; template.openid = MyCommFun.RequestOpenid(); template.OutPutHtml(wid); }
override protected void OnInit(EventArgs e) { base.OnInit(e); if (errInitTemplates != "") { Response.Write(errInitTemplates); return; } //1获得模版基本信息 BLL.wx_module_templates tBll = new BLL.wx_module_templates(); templateFileName = tBll.GetTemplatesFileNameByWid("shop", wid); if (templateFileName == null || templateFileName.Trim() == "") { errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!"; Response.Write(errInitTemplates); Response.End(); return; } MyCommFun.RequestOpenid(); MyCommFun.getTotalUrl(); serverPath = MyCommFun.GetRootPath() + "/shop/templates/" + templateFileName + "/index.html"; ShopTemplateMgr template = new ShopTemplateMgr("/shop/templates/" + templateFileName, serverPath, wid); template.tType = TemplateType.Index; template.openid = MyCommFun.RequestOpenid(); template.OutPutHtml(wid); }
/// <summary> /// 授权判断,页面跳转 /// </summary> /// <param name="state"></param> /// <param name="targetUrl">目标地址</param> public void OAuth2BaseProc(Model.wx_userweixin model, string state, string targetUrl) { BLL.wx_property_info propertyBll = new BLL.wx_property_info(); Model.wx_property_info propertyEntity = propertyBll.GetModelByIName(wid, MXEnums.WXPropertyKeyName.OpenOauth.ToString()); if (propertyEntity.iContent == "0") { //关闭了网页授权 openid = MyCommFun.RequestOpenid(); } else { string code = MyCommFun.QueryString("code"); if (code == null || code.Trim() == "") { if (targetUrl == null || targetUrl.Trim() == "") { targetUrl = MyCommFun.getTotalUrl(); } //thisUrl = MyCommFun.getWebSite() + "/weixin/huodong/index.aspx"; string newUrl = OAuthApi.GetAuthorizeUrl(model.AppId, targetUrl, state, OAuthScope.snsapi_base); // WXLogs.AddLog(model.id, "OAuth授权跳转页面", "获得OAuth2BaseProc", newUrl); Response.Redirect(newUrl); } else { var result = OAuthApi.GetAccessToken(model.AppId, model.AppSecret, code); openid = result.openid; } } }
override protected void OnInit(EventArgs e) { base.OnInit(e); if (errInitTemplates != "") { Response.Write(errInitTemplates); return; } //1获得模版基本信息 BLL.wx_templates tBll = new BLL.wx_templates(); templateIndexFileName = tBll.GetDetailTemplatesFileNameByWid(wid); if (templateIndexFileName == null || templateIndexFileName.Trim() == "") { errInitTemplates = "不存在该帐号或者该帐号尚未设置模版!"; Response.Write(errInitTemplates); Response.End(); return; } MyCommFun.RequestWid(); MyCommFun.getTotalUrl(); tPath = MyCommFun.GetRootPath() + "/templates/detail/" + templateIndexFileName + "/news_show.html"; TemplateMgr template = new TemplateMgr(tPath, wid); template.tType = TemplateType.News; template.openid = MyCommFun.RequestOpenid(); template.OutPutHtml("type1", wid); }
/// <summary> /// 输出最终的html /// </summary> /// <param name="templateFileName"></param> /// <param name="tPath"></param> /// <param name="wid"></param> public void OutPutHtml(string templateFileName) { ////注册一个自定义函数 //this.Document.RegisterGlobalFunction(this.GetNewsUrl); //对VT模板里的config变量赋值 Model.siteconfig config = new BLL.siteconfig().loadConfig(); string dd = Utils.ObjectToStr(config.webkeyword); this.Document.Variables.SetValue("config", config); this.Document.SetValue("ccright", ccRight); this.Document.SetValue("thisurl", MyCommFun.getTotalUrl()); this.Document.SetValue("yuming", MyCommFun.getWebSite()); string openid = MyCommFun.RequestOpenid(); this.Document.SetValue("openid", openid); this.Document.Variables.SetValue("this", this); if (tType == TemplateType.Class) { //如果为列表页面 ArticleClassPage(); } if (tType == TemplateType.News) { ArticleDetailPage(); } if (tType == TemplateType.Channel) { ArticleChannelPage(); } //输出最终呈现的数据 this.Document.Render(HttpContext.Current.Response.Output); }
/// <summary> /// 授权判断,页面跳转 /// </summary> /// <param name="state"></param> /// <param name="targetUrl">目标地址</param> public void OAuth2BaseProc(Model.wx_userweixin model, string state, string targetUrl) { var code = MyCommFun.QueryString("code"); openid = MyCommFun.QueryString("openid"); if (!string.IsNullOrEmpty(openid)) { return; } //如果不存在code,表示尚未和微信平台OAuth2 if (string.IsNullOrEmpty(code)) { if (targetUrl == null || targetUrl.Trim() == "") { targetUrl = MyCommFun.getTotalUrl(); } var newUrl = OAuthApi.GetAuthorizeUrl(model.AppId, targetUrl, state, OAuthScope.snsapi_base); Response.Redirect(newUrl); } else { var result = OAuthApi.GetAccessToken(model.AppId, model.AppSecret, code); Response.Redirect(string.Format("{0}&openid={1}", Request.Url, result.openid)); } }
/// <summary> /// 1 授权判断,页面跳转; /// 2 获取openid /// </summary> /// <param name="model"></param> /// <param name="state"></param> /// <param name="targetUrl">目标地址</param> public void OAuth2BaseProc(Model.wx_userweixin model, string state, string targetUrl) { string isTest = MyCommFun.getAppSettingValue("isOAuthTest"); if (isTest == "1") { openid = MyCommFun.RequestOpenid(); return; } string code = MyCommFun.QueryString("code"); if (code == null || code.Trim() == "") { if (targetUrl == null || targetUrl.Trim() == "") { targetUrl = MyCommFun.getTotalUrl(); } //thisUrl = MyCommFun.getWebSite() + "/weixin/huodong/index.aspx"; string newUrl = OAuthApi.GetAuthorizeUrl(model.AppId, targetUrl, state, OAuthScope.snsapi_base); Response.Redirect(newUrl); } else { if (MyCommFun.getCookie("cookie_openid") == "") { var result = OAuthApi.GetAccessToken(model.AppId, model.AppSecret, code); openid = result.openid; MyCommFun.setCookie("cookie_openid", openid, 100); } openid = MyCommFun.getCookie("cookie_openid"); } }
/// <summary> /// 输出最终的html /// </summary> /// <param name="templateFileName"></param> /// <param name="tPath"></param> /// <param name="wid"></param> public void OutPutHtml(string templateFileName, int wid) { //注册一个自定义函数 this.Document.RegisterGlobalFunction(this.GetNewsUrl); //对VT模板里的config变量赋值 Model.wxcodeconfig wxconfig = tDal.GetModelByWid(wid, "/templates/index/" + templateFileName); //if (wxconfig == null || wxconfig.sitename.Trim() == "") //{1e2124dd04e11d01b9df2865f85944be // HttpContext.Current.Response.Write("请填写【微网站设置】相关信息"); //} //else if (wxconfig.wxstatus == 0) { HttpContext.Current.Response.Write("帐号已过期!请及时充值!"); } this.Document.Variables.SetValue("config", wxconfig); //获得幻灯片列表方法一:缺点无法从模版页面控制记录数量 this.Document.Variables.SetValue("photo", tDal.GetHDPByWid(wid, -1)); this.Document.SetValue("wid", wid); this.Document.SetValue("bottomtype", wxconfig.bmenuTid); this.Document.SetValue("ccright", ccRight); this.Document.SetValue("thisurl", MyCommFun.getTotalUrl()); this.Document.SetValue("yuming", MyCommFun.getWebSite()); string openid = MyCommFun.RequestOpenid(); this.Document.SetValue("openid", openid); this.Document.Variables.SetValue("this", this); if (tType == TemplateType.Index) { //如果为首页页面 this.Document.SetValue("fxTitle", wxconfig.sitename); this.Document.SetValue("fxDesc", wxconfig.wbrief); this.Document.SetValue("fxPic", MyCommFun.ImgAddHttp(wxconfig.bgpic)); } if (tType == TemplateType.Class) { //如果为列表页面 ArticleClassPage(); } if (tType == TemplateType.News) { ArticleDetailPage(); } if (tType == TemplateType.Channel) { CategoryPage(); } //输出最终呈现的数据 this.Document.Render(HttpContext.Current.Response.Output); }
protected void Page_Load(object sender, EventArgs e) { wid = MyCommFun.RequestInt("wid"); //授权 BLL.wx_userweixin bll = new BLL.wx_userweixin(); Model.wx_userweixin wxModel = bll.GetModel(wid); string code = MyCommFun.QueryString("code"); if (code == null || code.Trim() == "") { string thisUrl = MyCommFun.getTotalUrl(); string newUrl = OAuthApi.GetAuthorizeUrl(wxModel.AppId, thisUrl, "fukuan", OAuthScope.snsapi_base); Response.Redirect(newUrl); } else { var result = OAuthApi.GetAccessToken(wxModel.AppId, wxModel.AppSecret, code); openid = result.openid; } //授权结束 // logBll.AddLog("【微支付】微信预定", "paypage.aspx Page_Load", " 授权结束openid= " + openid, 1); try { int otid = MyCommFun.RequestInt("orderid"); otid_str = otid.ToString(); rpage = "/api/payment/paypage.aspx?showwxpaytitle=1&paytype=shop&wid=" + wid + "&openid=" + openid + "&orderid=" + otid_str; if (code == null || code.Trim() == "" || openid == "" || otid == 0 || wid == 0) { return; } //expireMinute = MyCommFun.RequestInt("expireminute"); //if (expireMinute == 0) //{ // expireMinute = 30; //} //else if (expireMinute == -1) //{ //如果为-1,则有限期间为1年 // expireMinute = 60 * 12 * 365; //} BLL.orders otBll = new BLL.orders(); Model.orders orderEntity = otBll.GetModel(otid, wid); WXLogs.AddLog("【微支付】微信预定", "paypage.aspx Page_Load", "orderEntity.order_no: " + orderEntity.order_no + "|orderEntity.order_amount:" + orderEntity.order_amount, 1); litout_trade_no.Text = orderEntity.order_no; litMoney.Text = orderEntity.order_amount.ToString(); litDate.Text = orderEntity.add_time.ToString(); //WxPayData(orderEntity.order_amount, orderEntity.id.ToString(), orderEntity.order_no, code);//老的接口 WxPayDataV3(orderEntity.order_amount, orderEntity.id.ToString(), orderEntity.order_no, code); } catch (Exception ex) { WXLogs.AddLog("【微支付】微信预定", "paypage.aspx Page_Load", "ex: " + ex.Message, 1); //MessageBox.ShowAndRedirect(this, "支付有问题:" + ex.Message, "/shop/index.aspx?wid=" + wid); } }
/// <summary> /// 授权判断获取openid,如果code为空页面跳转 /// </summary> /// <param name="model"></param> /// <param name="state"></param> /// <param name="code">默认读取请求中的code属性</param> /// <param name="targetUrl">目标地址</param> protected string OAuth2BaseProc(Model.wx_userweixin model, string state, string code, string targetUrl) { string openid = String.Empty; #if DEBUG string isTest = MyCommFun.getAppSettingValue("isOAuthTest"); if (isTest == "1") { openid = MyCommFun.RequestOpenid(); return(openid); } #endif //如果不传 if (string.IsNullOrEmpty(code)) { code = MyCommFun.QueryString("code"); } if (code == null || code.Trim() == "") { if (targetUrl == null || targetUrl.Trim() == "") { targetUrl = MyCommFun.getTotalUrl(); } //thisUrl = MyCommFun.getWebSite() + "/weixin/huodong/index.aspx"; string newUrl = OAuthApi.GetAuthorizeUrl(model.AppId, targetUrl, state, OAuthScope.snsapi_base); //41008 缺少oauth code throw new UnAuthException(newUrl, "41008"); } else { if (MyCommFun.getCookie("cookie_openid") == "") { OAuthAccessTokenResult result = OAuthApi.GetAccessToken(model.AppId, model.AppSecret, code); openid = result.openid; MyCommFun.setCookie("cookie_openid", openid, 100); } openid = MyCommFun.getCookie("cookie_openid"); } return(openid); }
override protected void OnInit(EventArgs e) { base.OnInit(e); if (errInitTemplates != "") { Response.Write(errInitTemplates); return; } MyCommFun.RequestWid(); MyCommFun.getTotalUrl(); tPath = MyCommFun.GetRootPath() + "/templates_portal/index.html"; PortalTemplate template = new PortalTemplate(tPath); template.tType = TemplateType.Index; template.OutPutHtml(templateIndexFileName); }
public void OAuth2BaseProcOld(Model.wx_userweixin model, string state, string targetUrl) { string code = MyCommFun.QueryString("code"); if (code == null || code.Trim() == "") { if (targetUrl == null || targetUrl.Trim() == "") { targetUrl = MyCommFun.getTotalUrl(); } //thisUrl = MyCommFun.getWebSite() + "/weixin/huodong/index.aspx"; string newUrl = OAuthApi.GetAuthorizeUrl(model.AppId, targetUrl, state, OAuthScope.snsapi_base); // WXLogs.AddLog(model.id, "OAuth授权跳转页面", "获得OAuth2BaseProc", newUrl); Response.Redirect(newUrl); } else { var result = OAuthApi.GetAccessToken(model.AppId, model.AppSecret, code); openid = result.openid; } }
protected void Page_Load(object sender, EventArgs e) { OnlyWeiXinLook(); MyCommFun.getTotalUrl(); id = MyCommFun.RequestInt("id", 0); wid = MyCommFun.RequestWid(); openid = MyCommFun.RequestOpenid(); string whereStr = " wid=" + wid + " and id=" + id; wx_dati_base baseBll = new wx_dati_base(); Model.wx_dati_base baseDT = baseBll.GetModel(whereStr); //红包设置 bool hbreISopen = false; int reMsg = 0; bool hbISopen = true; //红包是否开启 int hbWhere = 0; //红包参与条件 int hbMTnum = 10; //第天领取人数 int hbMRnum = 5; //每人领取次数 int hbRCnum = 3; //容错次数 if (hbISopen) { hbreISopen = true; } //红包参与条件 //取用户答题记录 // int getUseridCount = baseBll.GetRecordCount(" openid='" + openid + "'"); // if (getUseridCount >= hbRCnum) hbreISopen = false; //用户信息 wx_dati_user userBLL = new wx_dati_user(); Model.wx_dati_user usermodel = userBLL.GetModel(" openid='" + openid + "' "); int getUseridCount = userBLL.GetRecordCount(" openid='" + openid + "'"); if (getUseridCount >= 3) { isusersub = true; } if (usermodel != null) { usersum = usermodel.score.ToString(); } ///end if (id == 0 || wid == 0 || openid.Trim() == "") { Response.Redirect("err.aspx?rev=1"); return; } if (baseDT.starttime > DateTime.Now) { //说明活动未开始 Response.Redirect("err.aspx?rev=2"); return; } if (baseDT.endtime <= DateTime.Now) { //说明活动已经结束 Response.Redirect("err.aspx?rev=3"); return; } htmlTitle = baseDT.title; summary = baseDT.summary; headimg = baseDT.headimg; bjcolor = baseDT.bjcolor; dtime = baseDT.dttime; dxgetnum = int.Parse(baseDT.dxgetnum.ToString()); ////// string dxwhereStr; if (dxgetnum > 0) {//抽取 int count = dxBLL.GetRecordCount(" pid=" + id); //////生成随机题号 string inStr = ""; Hashtable hashtable = new Hashtable(); Random rm = new Random(); int RmNum = dxgetnum; for (int i = 0; hashtable.Count < RmNum; i++) { int nValue = rm.Next(1, count); if (!hashtable.ContainsValue(nValue) && nValue != 0) { hashtable.Add(nValue, nValue); } } foreach (DictionaryEntry de in hashtable) { inStr += de.Value.ToString() + ","; } ///// dxwhereStr = " pid=" + id + " and isshow=1 and sid in (" + inStr.Substring(0, inStr.Length - 1) + ")"; } else { dxwhereStr = " pid=" + id + " and isshow=1 "; } dxDT = dxBLL.GetList(dxwhereStr); }
/// <summary> /// 列表页面独有的数据 /// </summary> public void ArticleClassPage() { int category_id = 0; int channel_id = 0; category_id = MyCommFun.RequestInt("cid"); if (category_id == 0) { var categoryid = this.Document.GetChildTagById("categoryid"); category_id = MyCommFun.Obj2Int(categoryid.Attributes["value"].Value.ToString()); } var channelid = this.Document.GetChildTagById("channel_id"); channel_id = MyCommFun.Obj2Int(channelid.Attributes["value"].Value.ToString()); //--=====begin: 将这个列表(文章类别)的基本信息展示出来 ====-- DAL.article_category cateDal = new DAL.article_category("dt_"); Model.article_category category = cateDal.GetModel(category_id); this.Document.SetValue("category", category); //--=====end: 将这个列表(文章类别)的基本信息展示出来 ====-- Tag orderByTag = this.Document.GetChildTagById("norderby"); string orderby = orderByTag.Attributes["value"].Value.ToString(); Tag pagesizeTag = this.Document.GetChildTagById("npagesize"); string pagesizeStr = pagesizeTag.Attributes["value"].Value.ToString(); int currPage = 1; //当前页面 int recordCount = 0; //总记录数 int totPage = 1; //总页数 int pageSize = MyCommFun.Str2Int(pagesizeStr); //每页的记录数 if (pageSize <= 0) { pageSize = 10; } if (MyCommFun.RequestInt("page") > 0) { currPage = MyCommFun.RequestInt("page"); } DataSet artlist = new DataSet(); if (category_id != 0) { DAL.article artDal = new DAL.article(); artlist = artDal.GetList("hotnews", category_id, pageSize, currPage, "channel_id=" + channel_id, orderby, out recordCount); if (artlist != null && artlist.Tables.Count > 0 && artlist.Tables[0].Rows.Count > 0) { DataRow dr; for (int i = 0; i < artlist.Tables[0].Rows.Count; i++) { dr = artlist.Tables[0].Rows[i]; if (dr["link_url"] == null || dr["link_url"].ToString().Trim().Length <= 0) { dr["link_url"] = "/portalpage/weixin_news_detail.aspx?id=" + dr["id"].ToString(); } artlist.AcceptChanges(); } totPage = recordCount / pageSize; int yushu = recordCount % pageSize; if (yushu > 0) { totPage += 1; } if (totPage < 1) { totPage = 1; } } if (currPage > totPage) { currPage = totPage; } } else { currPage = 1; recordCount = 0; totPage = 1; } this.Document.SetValue("totPage", totPage); //总页数 this.Document.SetValue("currPage", currPage); //当前页 this.Document.SetValue("newslist", artlist); //文章列表 string beforePageStr = ""; //上一页 string nextPageStr = ""; //下一页 string bgrey = "c-p-grey"; string ngrey = "c-p-grey"; if (currPage <= 1) { beforePageStr = "javascript:;"; bgrey = "c-p-grey"; } else { beforePageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage - 1)); beforePageStr = "href=\"" + beforePageStr + "\""; bgrey = ""; } if (currPage >= totPage) { nextPageStr = "javascript:;"; ngrey = " c-p-grey"; } else { nextPageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage + 1)); nextPageStr = "href=\"" + nextPageStr + "\""; ngrey = ""; } this.Document.SetValue("bpage", beforePageStr); //上一页 this.Document.SetValue("npage", nextPageStr); //下一页 this.Document.SetValue("bgrey", bgrey); //上一页灰色的样式 this.Document.SetValue("ngrey", ngrey); //下一页灰色的样式 }
public void ProductClassPage() { int category_id = MyCommFun.RequestInt("cid"); //--=====begin: 将这个列表(文章类别)的基本信息展示出来 ====-- DAL.wx_shop_category cateBll = new DAL.wx_shop_category(); Model.wx_shop_category category = cateBll.GetCategoryByWid(wid, category_id); this.Document.SetValue("category", category); this.Document.SetValue("wid", wid); //--=====end: 将这个列表(文章类别)的基本信息展示出来 ====-- Tag orderByTag = this.Document.GetChildTagById("norderby"); string orderby = orderByTag.Attributes["value"].Value.ToString(); Tag pagesizeTag = this.Document.GetChildTagById("npagesize"); string pagesizeStr = pagesizeTag.Attributes["value"].Value.ToString(); int currPage = 1; //当前页面 int recordCount = 0; //总记录数 int totPage = 1; //总页数 int pageSize = MyCommFun.Str2Int(pagesizeStr); //每页的记录数 if (pageSize <= 0) { pageSize = 10; } if (MyCommFun.RequestInt("page") > 0) { currPage = MyCommFun.RequestInt("page"); } DataSet productlist = new DataSet(); if (category_id != 0) { DAL.wx_shop_product artDal = new DAL.wx_shop_product(); productlist = artDal.GetList(wid, category_id, pageSize, currPage, "upselling=1", orderby, out recordCount); if (productlist != null && productlist.Tables.Count > 0 && productlist.Tables[0].Rows.Count > 0) { DataRow dr; for (int i = 0; i < productlist.Tables[0].Rows.Count; i++) { dr = productlist.Tables[0].Rows[i]; if (dr["link_url"] != null && dr["link_url"].ToString().Trim().Length > 0) { dr["link_url"] = MyCommFun.urlAddOpenid(dr["link_url"].ToString().Trim(), openid); } else { dr["link_url"] = MyCommFun.urlAddOpenid("detail.aspx?wid=" + wid + "&pid=" + dr["id"].ToString(), openid); } productlist.AcceptChanges(); } totPage = recordCount / pageSize; int yushu = recordCount % pageSize; if (yushu > 0) { totPage += 1; } if (totPage < 1) { totPage = 1; } } if (currPage > totPage) { currPage = totPage; } } else { currPage = 1; recordCount = 0; totPage = 1; } this.Document.SetValue("totPage", totPage); //总页数 this.Document.SetValue("currPage", currPage); //当前页 this.Document.SetValue("productlist", productlist); //文章列表 string beforePageStr = ""; //上一页 string nextPageStr = ""; //下一页 string bgrey = "c-p-grey"; string ngrey = "c-p-grey"; if (currPage <= 1) { beforePageStr = ""; bgrey = "c-p-grey"; } else { beforePageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage - 1)); beforePageStr = "href=\"" + beforePageStr + "\""; bgrey = ""; } if (currPage >= totPage) { nextPageStr = ""; ngrey = " c-p-grey"; } else { nextPageStr = MyCommFun.ChangePageNum(MyCommFun.getTotalUrl(), (currPage + 1)); nextPageStr = "href=\"" + nextPageStr + "\""; ngrey = ""; } this.Document.SetValue("bpage", beforePageStr); //上一页 this.Document.SetValue("npage", nextPageStr); //下一页 this.Document.SetValue("bgrey", bgrey); //上一页灰色的样式 this.Document.SetValue("ngrey", ngrey); //下一页灰色的样式 }
/// <summary> /// 输出最终的html /// </summary> /// <param name="templateFileName"></param> /// <param name="tPath"></param> /// <param name="wid"></param> public void OutPutHtml(int wid) { //注册一个自定义函数 this.Document.RegisterGlobalFunction(this.ComputeMoney); //对VT模板里的config变量赋值 Model.wxcodeconfig wxconfig = tDal.GetModelByWid(wid, tPath); if (wxconfig.wxstatus == 0) { HttpContext.Current.Response.Write("帐号已过期!请及时充值!"); } this.Document.Variables.SetValue("config", wxconfig); BLL.wx_shop_setting setBll = new BLL.wx_shop_setting(); if (!setBll.ExistsWid(wid)) { HttpContext.Current.Response.Write("请先选择模版!"); HttpContext.Current.Response.End(); } Model.wx_shop_setting setting = setBll.GetModelList("wid=" + wid)[0]; this.Document.Variables.SetValue("shopconfig", setting); this.Document.SetValue("wid", wid); this.Document.SetValue("ccright", ccRight); this.Document.SetValue("yuming", MyCommFun.getWebSite()); this.Document.SetValue("thisurl", MyCommFun.getTotalUrl()); this.Document.SetValue("indexurl", indexUrl()); this.Document.SetValue("categoryurl", MyCommFun.urlAddOpenid("/shop/category.aspx?wid=" + wid, openid)); this.Document.SetValue("carturl", "/shop/cart.aspx?wid=" + wid); this.Document.SetValue("userurl", "/shop/userinfo.aspx?wid=" + wid); this.Document.SetValue("openid", openid); this.Document.Variables.SetValue("this", this); if (tType == TemplateType.Class) { ProductClassPage(); } else if (tType == TemplateType.News) { ShopDetailPage(); } else if (tType == TemplateType.Cart) { CartDetailPage(); } else if (tType == TemplateType.confirmOrder) { confirmOrder(); } else if (tType == TemplateType.editaddr) { editAddrPage(); } else if (tType == TemplateType.orderSuccess) { OrderSuccessPage(); } else if (tType == TemplateType.userinfo) { userinfoPage(); } else if (tType == TemplateType.orderDetail) { //订单详情页面 orderDetail(); } //输出最终呈现的数据 this.Document.Render(HttpContext.Current.Response.Output); }