protected void Page_Load(object sender, EventArgs e) { userweixin = Request["userweixin"].ConvertTo <string>(""); guwenweixin = Request["guwenweixin"].ConvertTo <string>(""); if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid { //先通过正则表达式获取COMid comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString()); } if (comid == 0)//如果非标准格式,查询 是否有绑定的域名 { var domaincomid = B2bCompanyData.GetComId(RequestUrl); if (domaincomid != null) { comid = domaincomid.Com_id; } } #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; //微信接口设置信息是否正确 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["clienttypemark"].ConvertTo <int>(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 #region 注释掉 //string str = "260,110"; //int strnum = str.IndexOf(',', 0); //string a = str.Substring(0, strnum); //int d = str.Length; //string b = str; //string f = str.Substring(strnum+1, str.Length-strnum); //string c = a + b; #endregion }
protected void Page_Load(object sender, EventArgs e) { if (UserHelper.ValidateLogin()) { B2b_company company = UserHelper.CurrentCompany; comid = company.ID; } //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "001"); #region 微信扫描二维码,都用易城微信号的 comid = 106; 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,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的) } } }
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) { MasterId = Request["MasterId"].ConvertTo <int>(0); come = Request["come"].ConvertTo <string>(""); B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId); if (manageruser != null) { MasterId = manageruser.Id; MasterName = manageruser.Employeename; CompanyName = B2bCompanyData.GetCompanyByUid(manageruser.Id).Com_name; Tel = manageruser.Tel; Viewtel = manageruser.Viewtel; comid = manageruser.Com_id; B2bCrmData crmdata = new B2bCrmData(); var crmmodel = crmdata.GetB2bCrmByPhone(manageruser.Com_id, Tel); if (crmmodel != null) { if (crmmodel.Weixin != "") { zaixianzhuangtai = "我在线上"; guwenweixin = crmmodel.Weixin; } else { zaixianzhuangtai = "未在线"; } } var commodel = B2bCompanyData.GetCompany(comid); if (commodel != null) { title = 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)); } } ChannelCompanyId = manageruser.Channelcompanyid; ChannelCompany = new MemberChannelcompanyData().GetCompanyById(manageruser.Channelcompanyid.ToString().ConvertTo <int>(0)); if (ChannelCompany != null) { ChannelCompanyName = ChannelCompany.Companyname; } //获取渠道ID MemberChannelData channeldata = new MemberChannelData(); var channelmodel = channeldata.GetPhoneComIdChannelDetail(Tel, comid); if (channelmodel != null) { channelid = channelmodel.Id; } Channelsource = manageruser.Channelsource; CreateUserId = manageruser.Createuserid; EmployeState = manageruser.Employeestate; Job = manageruser.Job; Selfbrief = manageruser.Selfbrief; if (Selfbrief != "" && Selfbrief != null) { if (Selfbrief.Length > 21) { Selfbrief = Selfbrief.Substring(0, 21) + "..."; } } //Headimg=manageruser.Headimg; Headimgurl = FileSerivce.GetImgUrl(manageruser.Headimg); Workingyears = manageruser.Workingyears; Workdays = manageruser.Workdays; WorkdaysView = crmdata.WorkDay(Workdays);//判断是否在工作日内,1为在,0为不在 Workdaystime = manageruser.Workdaystime; Workendtime = manageruser.Workendtime; Fixphone = manageruser.Fixphone; Email = manageruser.Email; Homepage = manageruser.Homepage; Weibopage = manageruser.Weibopage; QQ = manageruser.QQ; Weixin = manageruser.Weixin; Selfhomepage_qrcordurl = manageruser.Selfhomepage_qrcordurl; //获取公司信息(微信连接地址) cominfo = B2bCompanyData.GetAllComMsg(comid); if (cominfo != null) { linkguanzhu = cominfo.B2bcompanyinfo.Wxfocus_url; author = cominfo.B2bcompanyinfo.Wxfocus_author; } //导航 var imagedata = new B2bCompanyMenuData(); int totalcount = 0; List <B2b_company_menu> list = imagedata.GetconsultantList(manageruser.Com_id, 1, 10, out totalcount); if (list != null) { for (int i = 0; i < list.Count; i++) { var imageurl = FileSerivce.GetImgUrl(list[i].Imgurl); if (firstmenuid == 0) { firstdaohang = list[i].Linktype; firstmenuid = list[i].Id; isoutpro = list[i].Outdata; } if (daohang_html == "") { daohang_html += "<li class=\"curr\" menu-id=\"" + list[i].Id + "\" data-id=\"" + list[i].Linktype + "\" data-isoutpro=\"" + list[i].Outdata + "\"><!--<img src=\"" + imageurl + "\" height=\"60px\">--><span>" + list[i].Name + "</span></li>"; } else { daohang_html += "<li class=\"\" menu-id=\"" + list[i].Id + "\" data-id=\"" + list[i].Linktype + "\" data-isoutpro=\"" + list[i].Outdata + "\"><!--<img src=\"" + imageurl + "\" height=\"60px\">--><span>" + list[i].Name + "</span></li>"; } //daohang_Imgurl_address = FileSerivce.GetImgUrl(list.Imgurl); //daohang_Imgurl = list.Imgurl; ///daohang_Linkurl = list.Linkurl; //daohang_Name = list.Name; //daohang_Fonticon = list.Fonticon; } } } ; //获取微信平台端code string weixincode = Request["code"].ConvertTo <string>(""); if (weixincode != "") { int questtype = 2;//1=微信授权验证 DealUserinfo1("", weixincode, comid, questtype); } else { string openid = Request["openid"].ConvertTo <string>(""); string weixinpass = Request["weixinpass"].ConvertTo <string>(""); int questtype = 1; //1=一次性密码验证 DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的) } //创建新的微信一次性密码 new_weixinpass = new B2bCrmData().WeixinGetPass(weixinopenid, comid); #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 }