protected void Page_Load(object sender, EventArgs e) { int id = int.Parse(Request.QueryString["id"].ToString()); var info = new WxMaterialData().Getidinfo(id); if (info != null) { price = info.Price.ToString() == null ? "" : info.Price.ToString(); titile = info.Title.ToString() == null ? "" : info.Title.ToString(); contxt = info.Article.ToString() == null ? "" : info.Article.ToString(); phone = info.Price.ToString() == null ? "" : info.Phone.ToString(); //图片链接 imgurl = FileSerivce.GetImgUrl(info.Imgpath.ToString().ConvertTo <int>(0)); var wspt = new WxSalePromoteTypeData().GetWxMenu(int.Parse(info.SalePromoteTypeid.ToString())); if (wspt.Typename.ToString() == "精选推荐") { type = "<a href=\"top10.aspx\">精选推荐</a> > ¥" + price + "起 -- " + titile + ""; } else { type = wspt.Typename.ToString(); } } else { Response.Redirect("/byts/login.aspx"); //type = "不存在文章详细,<input type=\"button\" onclick=\"javascript:history.go(-1)\" value=\"返回上一页\" />"; } }
protected void Page_Load(object sender, EventArgs e) { int id = int.Parse(Request.QueryString["id"].ToString()); var info = new WxMaterialData().Getidinfo(id); if (info != null) { titile = info.Title.ToString() == null ? "" : info.Title.ToString(); contxt = info.Article.ToString() == null ? "" : info.Article.ToString(); phone_tel = info.Phone.ToString() == null ? "" : info.Phone.ToString(); phone = "客服电话:"; //所属栏目 var wxdata = new WxSalePromoteTypeData().GetWxMenu(info.SalePromoteTypeid); if (wxdata != null) { wxtype = wxdata.Typename; } //contxt.Replace("../UploadFile", "http://image.etown.cn/UploadFile"); imgurl = "<img src=\"" + FileSerivce.GetImgUrl(info.Imgpath.ToString().ConvertTo <int>(0)) + "\">"; } }
public static string GetConsultantByComid(int comid, int id) { try { B2b_company_menu com = B2bCompanyMenuData.GetConsultantByComid(comid, id); var prodata = new B2bComProData(); var actdata = new WxMaterialData(); List <B2b_com_pro> Prolist = null; List <WxMaterial> WxMaterial = null; int totalcount1 = 0; if (com.Outdata == 0) { Prolist = prodata.Selectpagelist_diaoyong(comid.ToString(), 1, 50, "", out totalcount1, 0, 0, 0, id);//读出每个栏目的产品,每页12个 } if (com.Outdata == 2) { WxMaterial = actdata.WxMaterialPageList(comid, 1, 100, 10, 1000000, out totalcount1, "", 0, id); } return(JsonConvert.SerializeObject(new { type = 100, msg = com, Prolist = Prolist, WxMaterial = WxMaterial })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); } }
public static string GetMenuByComid(int comid, int id) { try { int totalcount1 = 0; int selectpro = 0; int totalcount2 = 0; List <WxMaterial> Material = null; var actdata = new WxMaterialData(); B2b_company_menu list = B2bCompanyMenuData.GetMenuByComid(comid, id); var prodata = new B2bComProData(); List <B2b_com_pro> Prolist = null; IEnumerable result = ""; if (list != null) { Prolist = prodata.Selectpagelist_diaoyong(comid.ToString(), 1, 12, "", out totalcount1, list.Projectlist, 0, id);//读出每个栏目的产品,每页12个 selectpro = prodata.Selectpagelist_ct(comid.ToString(), id); list.Imgurl_address = FileSerivce.GetImgUrl(list.Imgurl); Material = list.Menutype == 0 ? null : actdata.ShopWxMaterialPageList(comid, 1, 12, 10, id, list.Projectlist, out totalcount2, ""); } return(JsonConvert.SerializeObject(new { type = 100, msg = list, prolist = Prolist, selectpro = selectpro, Materiallist = Material })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); } }
protected void menu_ItemDataBound(object sender, RepeaterItemEventArgs e) { int totalcount = 0; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Repeater rep = e.Item.FindControl("Rplist") as Repeater; //找到里层的repeater对象 WxSalePromoteType rowv = (WxSalePromoteType)e.Item.DataItem; //找到分类Repeater关联的数据项 typeid = Convert.ToInt32(rowv.Id); //获取填充子类的id //if (typeid == 1 || typeid == 2 || typeid == 3 || typeid == 9 || typeid == 23) //{ periodical period = new WxMaterialData().GetPeriodicalBySaleType(comid, typeid); List <WxMaterial> list = new WxMaterialData().periodicaltypelist(1, 20, 10, period.Id, typeid, out totalcount); //if (totalcount > 0) //{ rep.DataSource = new WxMaterialData().periodicaltypelist(1, 20, 10, period.Id, typeid, out totalcount); rep.DataBind(); //} //else //{ // Label lb = e.Item.FindControl("lblEmpty") as Label; // lb.Text = "无推荐线路"; //} periodnum = period.Percal; //} } }
public string pernum(int typeid, int comid) { string num = ""; if (typeid == 1 || typeid == 2 || typeid == 3 || typeid == 9 || typeid == 23) { var period = new WxMaterialData().GetPeriodicalBySaleType(comid, typeid); num = "第 " + period.Percal.ToString() + " 期"; } return(num); }
public int Int_pernum(int typeid, int comid) { int num = 0; if (typeid == 1 || typeid == 2 || typeid == 3 || typeid == 9) { periodical period = new WxMaterialData().GetPeriodicalBySaleType(comid, typeid); num = period.Percal; } return(num); }
protected void Page_Load(object sender, EventArgs e) { var totalcount = 0; promotetypeid = Request["promotetypeid"].ConvertTo <int>(1); List <periodical> list = new WxMaterialData().periodicalList(1, 20, 10, promotetypeid, out totalcount); Repeater1.DataSource = list; Repeater1.DataBind(); promotetype = new WxSalePromoteTypeData().GetWxMenu(promotetypeid).Typename; }
private void ShowImgBind() { //根据素材id得到素材信息 WxMaterial wxmaterial = new WxMaterialData().GetWxMaterial(materialid); if (wxmaterial != null) { var identityFileUpload = new FileUploadData().GetFileById(wxmaterial.Imgpath.ToString().ConvertTo <int>(0)); if (identityFileUpload != null) { headPortraitImgSrc = identityFileUpload.Relativepath; } } }
public static string Getmenulist(int comid, int pageindex, int pagesize, int usetype = 0, int menuindex = 0) { int totalcount = 0; int totalcount1 = 0; int totalcount2 = 0; int totalcount3 = 0; try { var imagedata = new B2bCompanyMenuData(); var prodata = new B2bComProData(); var actdata = new WxMaterialData(); var projectdata = new B2b_com_projectData(); List <B2b_company_menu> list = imagedata.GetMenuList(comid, pageindex, pagesize, out totalcount, usetype, menuindex); IEnumerable result = ""; if (list != null) { result = from pro in list select new { Id = pro.Id, Com_id = pro.Com_id, Imgurl_address = FileSerivce.GetImgUrl(pro.Imgurl), Imgurl = pro.Imgurl, Linkurl = pro.Linkurl, Name = pro.Name, Fonticon = pro.Fonticon, Usestyle = pro.Usestyle, Menutype = pro.Menutype, Usetype = pro.Usetype, Projectlist = pro.Projectlist, menuindex = pro.menuindex, menuviewtype = pro.menuviewtype, hotellist = pro.menuviewtype == 1 ? projectdata.Projectpagelist(comid.ToString(), 1, 12, "1", out totalcount3, "", 1, pro.Projectlist, 9) : null, prolist = pro.Menutype == 0 ? prodata.Selectpagelist_diaoyong(comid.ToString(), 1, 12, "", out totalcount1, pro.Projectlist, 0, pro.Id) : null,//读出每个栏目的产品,每页12个 Materiallist = pro.Menutype == 0 ? null : actdata.ShopWxMaterialPageList(comid, 1, 12, 10, pro.Id, pro.Projectlist, out totalcount2, "") }; } return(JsonConvert.SerializeObject(new { type = 100, msg = result, totalCount = totalcount })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); } }
protected void menu_ItemDataBound(object sender, RepeaterItemEventArgs e) { int totalcount = 0; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Repeater rep = e.Item.FindControl("Rplist") as Repeater; //找到里层的repeater对象 WxSalePromoteType rowv = (WxSalePromoteType)e.Item.DataItem; //找到分类Repeater关联的数据项 typeid = Convert.ToInt32(rowv.Id); //获取填充子类的id var period = new WxMaterialData().GetPeriodicalBySaleType(comid, typeid); if (period != null) { rep.DataSource = new WxMaterialData().periodicaltypelist(1, 20, 10, period.Id, typeid, out totalcount); rep.DataBind(); periodnum = period.Percal; } } }
protected void Page_Load(object sender, EventArgs e) { RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower(); //根据域名读取商户ID,如果没有绑定域名直接跳转后台 if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid { //先通过正则表达式获取COMid comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString()); if (comid == 0) { comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid; } } else { B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl); if (companyinfo != null) { comid = companyinfo.Com_id; } } WxMaterialData wxdate = new WxMaterialData(); aid = wxdate.FrowardingSetList(comid); if (aid != 0) { WxMaterial wxinfo = wxdate.GetWxMaterial(aid); if (wxinfo != null) { wxTitle = wxinfo.Title; wxsummary = wxinfo.Summary; } } }
protected void Page_Load(object sender, EventArgs e) { materialid = int.Parse(Request.QueryString["materialid"].ToString()); WxMaterial wxmaterial = new WxMaterialData().GetWxMaterial(materialid); nowdate = DateTime.Now.ToString("yyyy-MM-dd"); if (wxmaterial != null) { id = wxmaterial.MaterialId; title = wxmaterial.Title; thisday = DateTime.Now.ToString("yyyy-MM-dd"); article = wxmaterial.Article; phone = "电话预定:" + wxmaterial.Phone; price = wxmaterial.Price.ToString(); if (price == "0.00" || price == "0") { price = ""; } else { price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price; price = "¥" + price + "元-"; } comid = wxmaterial.Comid; summary = wxmaterial.Summary; headPortraitImgSrc = FileSerivce.GetImgUrl(wxmaterial.Imgpath.ToString().ConvertTo <int>(0)); } }
protected void Page_Load(object sender, EventArgs e) { WxMaterialData Wx = new WxMaterialData(); WxMaterial wmater = Wx.logGetidinfo(" SalePromoteTypeid !=4 order by operatime desc "); int totalcount = 0; if (wmater != null) { Listtime = wmater.Operatime.ToString("yyyy-MM-dd"); } RequestUrl = Request.ServerVariables["SERVER_NAME"].ToString(); comid = Request["comid"].ConvertTo <int>(0); B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl); if (companyinfo != null) { comid = companyinfo.Com_id; } else { //判定是否为自助域名规则安 shop1.etown.cn if (Domain_def.Domain_yanzheng(RequestUrl)) { comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl)); } } if (comid != 0) { B2b_company com = B2bCompanyData.GetAllComMsg(comid); if (com != null) { Com_name = com.Com_name; Scenic_name = com.Scenic_name; Scenic_intro = com.B2bcompanyinfo.Scenic_intro; } } //菜单项new WxSalePromoteTypeData() List <WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetAllWxMaterialType(comid, out totalcount); if (comid == 101) { List <WxSalePromoteType> list = new List <WxSalePromoteType>(); int[] i = { 0, 1, 2, 5, 12 }; foreach (int s in i) { WxSalePromoteType wxmaterial = new WxSalePromoteType(); wxmaterial.Id = menulist[s].Id; wxmaterial.Typename = menulist[s].Typename; list.Add(wxmaterial); } menu.DataSource = list; menu.DataBind(); } else { List <WxSalePromoteType> list = new List <WxSalePromoteType>(); //int[] i = { 0, 1, 2, 5, 12 }; for (int s = 0; s < menulist.Count; s++) { WxSalePromoteType wxmaterial = new WxSalePromoteType(); wxmaterial.Id = menulist[s].Id; wxmaterial.Typename = menulist[s].Typename; var period = new WxMaterialData().GetPeriodicalBySaleType(comid, menulist[s].Id); if (period != null) { list.Add(wxmaterial); } } menu.DataSource = list; menu.DataBind(); } }
public string nextperiodcaurl = "#"; //下一期地址 protected void Page_Load(object sender, EventArgs e) { var totalcount = 0; id = Request["id"].ConvertTo <int>(0); type = Request["type"].ConvertTo <int>(0); //获取访问的域名 string RequestDomin = System.Web.HttpContext.Current.Request.ServerVariables["SERVER_NAME"].ToLower(); //根据访问的域名获得公司信息 WeiXinBasic basicc = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestDomin); if (basicc != null) { comid = basicc.Comid; //根据公司id得到公司logo地址和公司名称 comname = B2bCompanyData.GetCompany(comid).Com_name; B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (pro != null) { if (pro.Smalllogo != null && pro.Smalllogo != "") { comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0)); } } if (id == 0)//如果没有期号传过来,默认显示最新期 { id = new WxMaterialData().GetNewestPerical(type, comid); } } int periodid = id; int salepromotetypeid = type; if (id != 0 && type != 0) { List <WxMaterial> list = new WxMaterialData().periodicaltypelist(1, 20, 10, periodid, salepromotetypeid, out totalcount); //Repeater1.DataSource = list; //Repeater1.DataBind(); periodical per = new WxMaterialData().selectperiodical(id); if (per != null) { periodca = per.Percal; if (periodca > 1) { int lastperiodca = periodca - 1; periodical lastper = new WxMaterialData().Selperiod(lastperiodca, type); lastperiodcaurl = "/M/period.aspx?id=" + lastper.Id + "&type=" + type; } time = per.Uptime.ToString("yyyy-MM-dd"); peryear = per.Peryear; } wxtype = new WxSalePromoteTypeData().GetWxMenu(salepromotetypeid).Typename; over = new WxMaterialData().selectWxsaletype(salepromotetypeid, comid).Percal; if (periodca < over) { int nextperiodca = periodca + 1; periodical nextper = new WxMaterialData().Selperiod(nextperiodca, type); nextperiodcaurl = "/M/period.aspx?id=" + nextper.Id + "&type=" + type; } } }
public string authorpayurl = ""; //作者关注链接 protected void Page_Load(object sender, EventArgs e) { uid = Request["uid"].ConvertTo <int>(0); materialid = Request["materialid"].ConvertTo <int>(0); //获取IP地址 uip = CommonFunc.GetRealIP(); WxMaterial wxmaterial = new WxMaterialData().GetWxMaterial(materialid); nowdate = DateTime.Now.ToString("yyyy-MM-dd"); string weixincode = Request["code"].ConvertTo <string>(""); string openid = Request["openid"].ConvertTo <string>(""); if (wxmaterial != null) { authorpayurl = wxmaterial.Authorpayurl; comid = wxmaterial.Comid; Author = wxmaterial.Author; id = wxmaterial.MaterialId; title = wxmaterial.Title; thisday = DateTime.Now.ToString("yyyy-MM-dd"); article = wxmaterial.Article; Articleurl = wxmaterial.Articleurl; phone_tel = wxmaterial.Phone; phone = "客服电话:"; price = wxmaterial.Price.ToString(); datetime = wxmaterial.Operatime.ToString("yyyy-MM-dd"); if (price == "0.00" || price == "0") { price = ""; } else { price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price; price = "¥" + price; } //期 wxtype = wxmaterial.SalePromoteTypeid; percalid = wxmaterial.Periodicalid; periodical period = new WxMaterialData().selectperiodical(percalid); if (period != null) { percal = period.Percal; peryear = period.Peryear; } summary = wxmaterial.Summary; var identityFileUpload = new FileUploadData().GetFileById(wxmaterial.Imgpath.ToString().ConvertTo <int>(0)); if (identityFileUpload != null) { if (identityFileUpload.Relativepath != "") { headPortraitImgSrc = fileUrl + identityFileUpload.Relativepath; } } else { headPortraitImgSrc = ""; } //微信转发访问统计 if (uid != 0)//必须记录转发用户信息才能继续统计 { //查询是否有此cookies,有此cooki则证明已经访问过的用户 if (Request.Cookies["wxact" + materialid.ToString()] == null) { forward = new MemberForwardingData().Forwardingcount(uid, materialid, uip, comid); if (forward > 0) { HttpCookie cookie = new HttpCookie("wxact" + materialid.ToString()); //实例化HttpCookie类并添加值 cookie.Value = "yes"; cookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(cookie); } } //判断有转发人的渠道 var crmdata = new B2bCrmData(); var pro = crmdata.Readuser(uid, comid);//读取转发人用户信息 string zhuanfa_phone = ""; if (pro != null) { zhuanfa_phone = pro.Phone; } if (zhuanfa_phone != "") { //转发人手机存在 MemberChannelData channeldata = new MemberChannelData(); var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道 if (channeinfo != null) { //转发人渠道记录COOKI HttpCookie cookie = new HttpCookie("ZF_ChanneId"); //实例化HttpCookie类并添加值 cookie.Value = channeinfo.Id.ToString(); cookie.Expires = DateTime.Now.AddDays(120); Response.Cookies.Add(cookie); cookie = new HttpCookie("ZF_WxmaterialId"); //实例化HttpCookie类并添加值 cookie.Value = materialid.ToString(); cookie.Expires = DateTime.Now.AddDays(120); Response.Cookies.Add(cookie); } } } } if (comid != 0) { if (weixincode != "") { int questtype = 2;//1=微信授权验证 DealUserinfo1("", weixincode, comid, questtype); } else if (openid != "") { string weixinpass = Request["weixinpass"].ConvertTo <string>(""); int questtype = 1; //1=一次性密码验证 DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的) } } }
protected void Page_Load(object sender, EventArgs e) { WxMaterialData Wx = new WxMaterialData(); WxMaterial wmater = Wx.logGetidinfo(" SalePromoteTypeid !=4 order by operatime desc "); int totalcount = 0; if (wmater != null) { Listtime = wmater.Operatime.ToString("yyyy-MM-dd"); } ////判断如果是否为手机访问 //if (detectmobilebrowser.HttpUserAgent(Request.ServerVariables["HTTP_USER_AGENT"])) //{ // if (Request["brow"]=="PC")//如果接收到传递PC访问则只PC版 // { // Cookie.WriteCookie("Mobile_Brow_Set", "PC"); // } // // //查看COOKIE 是否设定是否设定为PC // if (Cookie.GetCookie("Mobile_Brow_Set") == "PC") // { // } // else // { // Response.Redirect("/M/Default.aspx?brow=MO"); // } //} if (Session["AccountId"] != null) { //账户信息 AccountId = Int32.Parse(Session["AccountId"].ToString()); AccountName = Session["AccountName"].ToString(); AccountCard = Session["AccountCard"].ToString(); RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower(); B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl); if (companyinfo != null) { comid = companyinfo.Com_id; } if (comid != 101) { Response.Redirect("/ui/shangjiaui/ProductList.aspx"); } //会员信息 B2bCrmData dateuser = new B2bCrmData(); B2b_crm modeluser = dateuser.Readuser(AccountId, comid); if (modeluser != null) { AccountWeixin = modeluser.Weixin; AccountEmail = modeluser.Email; Accountphone = modeluser.Phone; Servercard = modeluser.Servercard; Imprest = modeluser.Imprest; Integral = modeluser.Integral; //密码 AccountPass = modeluser.Password1; //微信关注 weixin = modeluser.Weixin == "" ? "未关注" : "已关注"; } //渠道 MemberChannelData channeldate = new MemberChannelData(); //渠道信息 Member_Channel channelmodel = channeldate.GetSelfChannelDetailByCardNo(AccountCard); if (channelmodel != null) { channeltype = 1; channelid = channelmodel.Id; RebateConsume = channelmodel.RebateConsume; RebateOpen = channelmodel.RebateOpen; Opencardnum = channelmodel.Opencardnum; Firstdealnum = channelmodel.Firstdealnum; Summoney = channelmodel.Summoney; } //服务专员信息,服务专员ID if (Servercard != 0) { Member_Channel channelmode2 = channeldate.GetChannelDetail(Int32.Parse(Servercard.ToString())); if (channelmode2 != null) { Servername = channelmode2.Name; Servermobile = channelmode2.Mobile; } } //菜单项new WxSalePromoteTypeData() List <WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetAllWxMaterialType(comid, out totalcount); if (comid == 101) { List <WxSalePromoteType> list = new List <WxSalePromoteType>(); int[] i = { 0, 1, 2, 5, 12 }; foreach (int s in i) { WxSalePromoteType wxmaterial = new WxSalePromoteType(); wxmaterial.Id = menulist[s].Id; wxmaterial.Typename = menulist[s].Typename; list.Add(wxmaterial); } menu.DataSource = list; menu.DataBind(); } else { menu.DataSource = menulist; menu.DataBind(); } } else { Response.Redirect("/V/card.aspx"); } }
public int isrightwxset = 1; //微信接口设置信息是否正确 protected void Page_Load(object sender, EventArgs e) { openid = Request["openid"].ConvertTo <string>(""); //uid = Request["uid"].ConvertTo<int>(0); //weixinpass = Request["weixinpass"].ConvertTo<string>(""); comid = Request["comid"].ConvertTo <int>(0); clientuptypemark = Request["clientuptypemark"].ConvertTo <int>(0); materialid = Request["materialid"].ConvertTo <int>(0); //根据openid得到员工信息 if (openid != "") { B2b_company_manageuser muser = new B2bCompanyManagerUserData().GetCompanyUserByOpenid(openid); if (muser != null) { username = muser.Employeename; } } //根据materialid 得到文章信息 if (materialid > 0) { WxMaterial msucai = new WxMaterialData().GetWxMaterial(materialid); if (msucai != null) { materialname = msucai.Title; } } #region 微信语音播放接口会用到 string url = Request.Url.ToString(); //根据传入参数openid、comid 得到 access_token、jsapi_ticket、noncestr、timestamp、 url(当前网页的URL,不包含#及其后面部分) WeiXinBasic basic = new WeiXinBasicData().GetWxBasicByComId(comid); if (basic != null) { appId = basic.AppId; timestamp = new WeixinVoiceUtil().CreatenTimestamp(); nonceStr = new WeixinVoiceUtil().CreatenNonce_str(); WXAccessToken maccesstoken = new WeixinVoiceUtil().GetAccessToken(comid, basic.AppId, basic.AppSecret); if (maccesstoken != null) { string jsapi_ticket = new WeixinVoiceUtil().GetTickect(maccesstoken.ACCESS_TOKEN, comid); if (jsapi_ticket == "") { isrightwxset = 0; } else { string beforesha1_signature = ""; signature = new WeixinVoiceUtil().GetSignature(jsapi_ticket, nonceStr, timestamp, url, out beforesha1_signature); } } else { isrightwxset = 0; } } else { isrightwxset = 0; } #endregion }
public int isrightwxset = 1; //微信接口设置信息是否正确 #endregion protected void Page_Load(object sender, EventArgs e) { materialid = Request["materialid"].ConvertTo <int>(0); uid = Request["uid"].ConvertTo <int>(0); //获取IP地址 uip = CommonFunc.GetRealIP(); WxMaterial wxmaterial = new WxMaterialData().GetWxMaterial(materialid); string weixincode = Request["code"].ConvertTo <string>(""); openid = Request["openid"].ConvertTo <string>(""); #region 材信息 if (wxmaterial != null) { authorpayurl = wxmaterial.Authorpayurl; Author = wxmaterial.Author; datetime = wxmaterial.Operatime.ToString("yyyy-MM-dd"); comid = wxmaterial.Comid; id = wxmaterial.MaterialId; title = wxmaterial.Title; thisday = DateTime.Now.ToString("yyyy-MM-dd"); article = wxmaterial.Article; phone_tel = wxmaterial.Phone; Articleurl = wxmaterial.Articleurl; phone = "客服电话:"; price = wxmaterial.Price.ToString(); if (price == "0.00" || price == "0") { price = ""; } else { price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price; price = "¥" + price + "元-"; } summary = wxmaterial.Summary; var identityFileUpload = new FileUploadData().GetFileById(wxmaterial.Imgpath.ToString().ConvertTo <int>(0)); if (identityFileUpload != null) { if (identityFileUpload.Relativepath != "") { headPortraitImgSrc = fileUrl + identityFileUpload.Relativepath; } else { headPortraitImgSrc = ""; } } } #endregion #region 微信转发访问统计 if (uid != 0)//必须记录转发用户信息才能继续统计 { //查询是否有此cookies,有此cooki则证明已经访问过的用户 if (Request.Cookies["wxact" + materialid.ToString()] == null) { var forward = new MemberForwardingData().Forwardingcount(uid, materialid, uip, comid); if (forward > 0) { HttpCookie cookie = new HttpCookie("wxact" + materialid.ToString()); //实例化HttpCookie类并添加值 cookie.Value = "yes"; cookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(cookie); } } //判断有转发人的渠道 var crmdata = new B2bCrmData(); var pro = crmdata.Readuser(uid, comid);//读取转发人用户信息 string zhuanfa_phone = ""; if (pro != null) { zhuanfa_phone = pro.Phone; } if (zhuanfa_phone != "") { //转发人手机存在 MemberChannelData channeldata = new MemberChannelData(); var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道 if (channeinfo != null) { //转发人渠道记录COOKI HttpCookie cookie = new HttpCookie("ZF_ChanneId"); //实例化HttpCookie类并添加值 cookie.Value = channeinfo.Id.ToString(); cookie.Expires = DateTime.Now.AddDays(120); Response.Cookies.Add(cookie); cookie = new HttpCookie("ZF_WxmaterialId"); //实例化HttpCookie类并添加值 cookie.Value = materialid.ToString(); cookie.Expires = DateTime.Now.AddDays(120); Response.Cookies.Add(cookie); } } } #endregion if (comid != 0) { #region 微信语音播放接口会用到 string url = Request.Url.ToString(); //根据传入参数openid、comid 得到 access_token、jsapi_ticket、noncestr、timestamp、 url(当前网页的URL,不包含#及其后面部分) WeiXinBasic basic = new WeiXinBasicData().GetWxBasicByComId(comid); if (basic != null) { appId = basic.AppId; timestamp = new WeixinVoiceUtil().CreatenTimestamp(); nonceStr = new WeixinVoiceUtil().CreatenNonce_str(); WXAccessToken maccesstoken = new WeixinVoiceUtil().GetAccessToken(comid, basic.AppId, basic.AppSecret); if (maccesstoken != null) { string jsapi_ticket = new WeixinVoiceUtil().GetTickect(maccesstoken.ACCESS_TOKEN, comid); if (jsapi_ticket == "") { isrightwxset = 0; } else { string beforesha1_signature = ""; signature = new WeixinVoiceUtil().GetSignature(jsapi_ticket, nonceStr, timestamp, url, out beforesha1_signature); } } else { isrightwxset = 0; } } else { isrightwxset = 0; } #endregion var commodel = B2bCompanyData.GetCompany(comid); if (commodel != null) { if (commodel.B2bcompanyinfo != null) { Wxfocus_url = commodel.B2bcompanyinfo.Wxfocus_url; Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author; weixinname = commodel.B2bcompanyinfo.Weixinname; Scenic_intro = commodel.B2bcompanyinfo.Scenic_intro; } Com_name = commodel.Com_name; } B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (pro != null) { if (pro.Smalllogo != null && pro.Smalllogo != "") { comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0)); } } if (weixincode != "") { int questtype = 2;//1=微信授权验证 DealUserinfo1("", weixincode, comid, questtype); } else if (openid != "") { string weixinpass = Request["weixinpass"].ConvertTo <string>(""); int questtype = 1; //1=一次性密码验证 DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的) } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["AccountId"] != null) { WxMaterialData Wx = new WxMaterialData(); WxMaterial wmater = Wx.logGetidinfo(" SalePromoteTypeid !=4 order by operatime desc "); int totalcount = 0; if (wmater != null) { Listtime = wmater.Operatime.ToString("yyyy-MM-dd"); } //账户信息 AccountId = Int32.Parse(Session["AccountId"].ToString()); AccountName = Session["AccountName"].ToString(); AccountCard = Session["AccountCard"].ToString(); RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower(); B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl); if (companyinfo != null) { comid = companyinfo.Com_id; } //会员信息 B2bCrmData dateuser = new B2bCrmData(); B2b_crm modeluser = dateuser.Readuser(AccountId, comid); if (modeluser != null) { AccountWeixin = modeluser.Weixin; AccountEmail = modeluser.Email; Accountphone = modeluser.Phone; Servercard = modeluser.Servercard; Imprest = modeluser.Imprest; Integral = modeluser.Integral; //密码 AccountPass = modeluser.Password1; //微信关注 weixin = modeluser.Weixin == "" ? "未关注" : "已关注"; } //渠道 MemberChannelData channeldate = new MemberChannelData(); //渠道信息 Member_Channel channelmodel = channeldate.GetSelfChannelDetailByCardNo(AccountCard); if (channelmodel != null) { channeltype = 1; channelid = channelmodel.Id; RebateConsume = channelmodel.RebateConsume; RebateOpen = channelmodel.RebateOpen; Opencardnum = channelmodel.Opencardnum; Firstdealnum = channelmodel.Firstdealnum; Summoney = channelmodel.Summoney; } //服务专员信息,服务专员ID if (Servercard != 0) { Member_Channel channelmode2 = channeldate.GetChannelDetail(Int32.Parse(Servercard.ToString())); if (channelmode2 != null) { Servername = channelmode2.Name; Servermobile = channelmode2.Mobile; } } ////菜单项new WxSalePromoteTypeData() //List<WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetAllWxMaterialType(comid, out totalcount); //菜单项new WxSalePromoteTypeData() List <WxSalePromoteType> menulist = new WxSalePromoteTypeData().GetRecommendWxMaterialType(comid, out totalcount); if (comid == 101) { List <WxSalePromoteType> list = new List <WxSalePromoteType>(); int[] i = { 0, 1, 2, 5, 12 }; foreach (int s in i) { WxSalePromoteType wxmaterial = new WxSalePromoteType(); wxmaterial.Id = menulist[s].Id; wxmaterial.Typename = menulist[s].Typename; list.Add(wxmaterial); } menu.DataSource = list; menu.DataBind(); } else { menu.DataSource = menulist; menu.DataBind(); } //得到微信会员卡说明和使用门店说明 int ttcount = 0; mcMaterilList = new MemberShipCardMaterialData().GetMCMateralListByComId(comid, out ttcount); } else { Response.Redirect("/byts/login.aspx"); } }