private WxPayData UnifiedOrder(string openId, string productId, WxPayConfig config) { #region productid中包含oid,则传递过来的是订单号 if (productId.IndexOf("oid") > -1) { B2b_order morder = new B2bOrderData().GetOrderById(productId.Substring(3).ConvertTo <int>(0)); if (morder == null) { throw new WxPayException("原生支付订单查询失败!"); } B2b_com_pro modelcompro = new B2bComProData().GetProById(morder.Pro_id.ToString()); if (modelcompro == null) { throw new WxPayException("原生支付产品查询失败!"); } string price = "0"; //单价 string pricedetail = ""; //价格描述 decimal p_totalprice1 = new B2bOrderData().GetOrderTotalPrice(modelcompro, morder, out price, out pricedetail); string wxp_totalprice = (p_totalprice1 * 100).ToString("F0"); if (p_totalprice1 == 0 || price == "0") { throw new WxPayException("订单金额不可为0!"); } //统一下单 WxPayData req = new WxPayData(); req.SetValue("body", modelcompro.Pro_name); req.SetValue("attach", ""); req.SetValue("out_trade_no", productId.Substring(3)); req.SetValue("total_fee", wxp_totalprice); req.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); req.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss")); req.SetValue("goods_tag", ""); req.SetValue("trade_type", "NATIVE"); req.SetValue("openid", openId); req.SetValue("product_id", productId); WxPayData result = WxPayApi.UnifiedOrder(req, config); return(result); } #endregion #region productid中包含pid,则传递过来的是产品号 else if (productId.IndexOf("pid") > -1) { throw new WxPayException("暂时原生支付只是用于PC线上付款!"); } #endregion #region productid中pid和oid 均不包含 else { throw new WxPayException("暂时原生支付只是用于PC线上付款!!"); } #endregion }
private decimal GetSettlementPrice(int agentid, string partnerDealId) { decimal settlementPrice = 0; //结算价 Agent_warrant warrant = new Agent_companyData().GetAgentWarrantInfo(agentinfo.Id, partnerDealId.ConvertTo <int>(0)); if (warrant != null) { settlementPrice = new B2bComProData().GetAgentPrice(partnerDealId.ConvertTo <int>(0), warrant.Warrant_level); } return(settlementPrice); }
protected void Page_Load(object sender, EventArgs e) { id = Request["id"].ConvertTo <int>(0); var ProData = new B2bComProData(); var proinfo = ProData.GetProById(id.ToString()); if (proinfo != null) { fproname = proinfo.Pro_name; } }
public int IsYouXiao = 0; //产品是否可以提单 protected void Page_Load(object sender, EventArgs e) { lineid = Request["lineid"].ConvertTo <int>(0); adultnum = Request["adultnum"].ConvertTo <int>(0); childnum = Request["childnum"].ConvertTo <int>(0); outdate = Request["outdate"].ConvertTo <string>(""); //从cookie中得到微信号 if (Request.Cookies["openid"] != null) { openid = Request.Cookies["openid"].Value; } if (lineid != 0) { var prodata = new B2bComProData(); var pro = prodata.GetProById(lineid.ToString()); if (pro != null) { int ordernum = adultnum + childnum; IsYouXiao = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state, outdate, ordernum); pro_name = pro.Pro_name; com_id = pro.Com_id; pro_state = pro.Pro_state; pro_Remark = pro.Pro_Remark; face_price = pro.Face_price; advise_price = pro.Advise_price; childreduce = pro.Childreduce; sms = pro.Sms; travelproductid = pro.Travelproductid; //读取団期价格//根据实际选择的団期报价 B2b_com_LineGroupDate linemode = new B2b_com_LineGroupDateData().GetLineDayGroupDate(DateTime.Parse(outdate), lineid); if (linemode != null) { advise_price = linemode.Menprice; decimal childprice = advise_price - childreduce; if (childprice < 0) { childprice = 0; } pricedetail = "成人" + advise_price + "元/人,儿童" + childprice + "元/人"; } linepro_booktype = pro.Linepro_booktype; } } }
public int addrid = 0;//常用地址id,只有实物产品用到 protected void Page_Load(object sender, EventArgs e) { proid = Request["proid"].ConvertTo <string>(""); Agentid = Request["agentid"].ConvertTo <int>(0); comid_temp = Request["comid"].ConvertTo <int>(0); addrid = Request["addrid"].ConvertTo <int>(0); //去除最右侧,号 if (proid != "") { if (proid.Substring(proid.Length - 1, 1) == ",") { proid = proid.Substring(0, proid.Length - 1); } } var proid_arr = proid.Split(','); int id = int.Parse(proid_arr[0]);//得到第一个ID,读取基本的COMID,及公司信息 B2bComProData prodate = new B2bComProData(); var proinfo = prodate.GetProById(id.ToString()); if (proinfo != null) { comid_temp = proinfo.Com_id; //作废超时未支付订单,完成回滚操作 int rs = new B2bComProData().CancelOvertimeOrder(proinfo); } //获取每个产品数量 var list = new B2bOrderData().SearchCartList(comid_temp, Agentid, proid); if (list != null) { for (int i = 0; i < list.Count; i++) { num += list[i].U_num + ","; } } //去除最右侧,号 if (num != "") { if (num.Substring(num.Length - 1, 1) == ",") { num = num.Substring(0, num.Length - 1); } } }
public static string Selhotelproductlist(int comid, int projectid) { List <B2b_com_pro> list = new B2bComProData().Selhotelproductlist(comid, projectid); if (list.Count > 0) { return(JsonConvert.SerializeObject(new { type = 100, msg = list })); } else { return(JsonConvert.SerializeObject(new { type = 1, msg = "" })); } }
private static string GetProjectImg(int projectimg, int projectid) { if (projectimg == 0 || projectimg == 3962) { //得到项目下第一个在线产品图片做为项目图片 int firstimg = new B2bComProData().GetFirstProImgInProjectId(projectid); return(FileSerivce.GetImgUrl(firstimg)); } else { return(FileSerivce.GetImgUrl(projectimg)); } }
public string travelending; //目的地 protected void Page_Load(object sender, EventArgs e) { lineid = Request["lineid"].ConvertTo <int>(0); if (lineid != 0) { var prodata = new B2bComProData(); var pro = prodata.GetProById(lineid.ToString()); if (pro != null) { pro_name = pro.Pro_name; com_id = pro.Com_id; pro_state = pro.Pro_state; server_type = pro.Server_type; pro_type = pro.Pro_type; source_type = pro.Source_type; pro_Remark = pro.Pro_Remark; pro_start = pro.Pro_start; pro_end = pro.Pro_end; face_price = pro.Face_price; advise_price = pro.Advise_price; agent1_price = pro.Agent1_price; agent2_price = pro.Agent2_price; agent3_price = pro.Agent3_price; agentsettle_price = pro.Agentsettle_price; thatDay_can = pro.ThatDay_can; thatday_can_day = pro.Thatday_can_day; service_Contain = pro.Service_Contain; service_NotContain = pro.Service_NotContain; precautions = pro.Precautions; tuan_pro = pro.Tuan_pro; zhixiao = pro.Zhixiao; agentsale = pro.Agentsale; createtime = pro.Createtime; sms = pro.Sms; createuserid = pro.Createuserid; imgurl = pro.Imgurl; pro_number = pro.Pro_number; pro_explain = pro.Pro_explain; tuipiao = pro.Tuipiao; tuipiao_guoqi = pro.Tuipiao_guoqi; tuipiao_endday = pro.Tuipiao_endday; imgaddress = FileSerivce.GetImgUrl(pro.Imgurl); projectid = pro.Projectid; travelproductid = pro.Travelproductid; travelstarting = pro.Travelstarting; travelending = pro.Travelending; } } }
public static string GetChannelProList(int comid, int id) { try { var prodata = new B2bComProData(); int totalcount1 = 0; var Prolist = prodata.Selectpagelist_diaoyong(comid.ToString(), 1, 50, "", out totalcount1, 0, 0, 0, id);//读出每个栏目的产品,每页12个 return(JsonConvert.SerializeObject(new { type = 100, msg = Prolist })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message })); } }
private void ShowImgBind(int proid) { //根据产品id得到 产品信息 B2b_com_pro proo = new B2bComProData().GetProById(proid.ToString()); if (proo != null) { Source_type = proo.Source_type; var identityFileUpload = new FileUploadData().GetFileById(proo.Imgurl.ToString().ConvertTo <int>(0)); if (identityFileUpload != null) { headPortraitImgSrc = identityFileUpload.Relativepath; } } }
public List <B2b_com_pro_Speci> gglist = null;//规格列表 protected void Page_Load(object sender, EventArgs e) { proid = Request["proid"].ConvertTo <int>(0); var prodata = new B2bComProData(); if (proid != 0) { var proinfo = prodata.GetProById(proid.ToString()); if (proinfo != null) { proname = proinfo.Pro_name; manyspeci = proinfo.Manyspeci; gglist = new B2b_com_pro_SpeciData().Getgglist(proinfo.Id); } } }
protected void Page_Load(object sender, EventArgs e) { comid = Request["comid"].ConvertTo <int>(0); agentid = Request["agentid"].ConvertTo <int>(0); orderid = Request["orderid"].ConvertTo <int>(0); md5info = Request["md5info"].ConvertTo <string>(""); string Returnmd5 = EncryptionHelper.ToMD5(orderid.ToString() + comid.ToString() + agentid.ToString() + "lixh1210", "UTF-8"); if (Returnmd5 == md5info)//验证MD5 { B2bOrderData orderdate = new B2bOrderData(); B2b_order ordermodel = orderdate.GetOrderById(orderid); if (ordermodel != null) { B2bComProData prodata = new B2bComProData(); B2b_com_pro promodel = prodata.GetProById(ordermodel.Pro_id.ToString()); if (promodel != null) { if (ordermodel.Agentid == agentid && ordermodel.Comid == comid && ordermodel.Warrant_type == 2) { ExcelRender.RenderToExcel( ExcelSqlHelper.ExecuteDataTable(CommandType.Text, "select e_proname [产品名称],pno [票号],pnum [数量] from b2b_eticket where oid=" + orderid), Context, promodel.Pro_name + ordermodel.U_subdate.Date.ToString("yyyyMMdd") + "-" + ordermodel.Id.ToString() + ".xls"); } else { err = "订单参数错误"; } } else { err = "产品错误"; } } else { err = "订单错误"; } } else { err = "验证错误"; } }
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 })); } }
public string firststationtime = ""; //发车时间 protected void Page_Load(object sender, EventArgs e) { proid = Context.Request["proid"].ConvertTo <int>(0); daydate = Context.Request["daydate"].ConvertTo <string>(""); oper = Context.Request["oper"].ConvertTo <string>(""); B2b_com_pro pro = new B2bComProData().GetProById(proid.ToString()); if (pro != null) { // 作废超时未支付订单,完成回滚操作 int rs = new B2bComProData().CancelOvertimeOrder(pro); pickuppoint = pro.pickuppoint; dropoffpoint = pro.dropoffpoint; advise_price = pro.Advise_price; emptynum = new B2b_com_LineGroupDateData().GetEmptyNum(proid, DateTime.Parse(daydate)); comid = pro.Com_id; firststationtime = pro.firststationtime; } }
protected void Page_Load(object sender, EventArgs e) { comid = Request["comid"].ConvertTo <int>(0); if (comid > 0) { B2b_company company = new B2bCompanyData().GetCompanyBasicById(comid); //判断公司是否含有项目,不含有的话,添加默认项目 int count = new B2b_com_projectData().GetProjectCountByComId(company.ID); if (count == 0) { B2b_company_info companyinfo = new B2bCompanyInfoData().GetCompanyInfo(company.ID); B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(company.ID.ToString()); B2b_com_project model = new B2b_com_project() { Id = 0, Projectname = company.Com_name, Projectimg = saleset.Logo.ConvertTo <int>(0), Province = companyinfo.Province.ConvertTo <string>(""), City = companyinfo.City, Industryid = company.Com_type, Briefintroduce = companyinfo.Scenic_intro, Address = companyinfo.Scenic_address, Mobile = companyinfo.Tel, Coordinate = "", Serviceintroduce = companyinfo.Serviceinfo, Onlinestate = "1", Comid = company.ID, Createtime = DateTime.Now, Createuserid = 0 }; int result = new B2b_com_projectData().EditProject(model); //设置公司下产品的项目id都改为默认项目id int result2 = new B2bComProData().UpProjectId(company.ID.ToString(), result); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["AccountId"] != null) { AccountId = Session["AccountId"].ToString(); AccountName = Session["AccountName"].ToString(); AccountCard = Session["AccountCard"].ToString(); Today = DateTime.Now.ToString("yyyy-MM-dd"); } comid = Request["comid"].ConvertTo <int>(0); proid = Request["proid"].ConvertTo <string>(""); orderid = Request["orderid"].ConvertTo <int>(0); ordertype = Request["ordertype"].ConvertTo <string>("1"); RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower(); if (Request.QueryString["out_trade_no"] != null) { orderid = Request.QueryString["out_trade_no"].ConvertTo <int>(0); //根据订单id得到订单信息 B2bOrderData dataorder = new B2bOrderData(); B2b_order modelb2border = dataorder.GetOrderById(orderid); proid = modelb2border.Pro_id.ToString(); } //读产品信息 if (proid != "") { //根据产品id得到产品信息 B2bComProData datapro = new B2bComProData(); B2b_com_pro modelcompro = datapro.GetProById(proid); if (modelcompro != null) { proname = modelcompro.Pro_name; comid = modelcompro.Com_id; } } //针对支付同步返回页,暂时无法绑定域名 if (Request.QueryString["out_trade_no"] == null) { //根据域名读取商户ID,如果没有绑定域名直接跳转后台 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)); } else { if (RequestUrl == "shop.etown.cn" || RequestUrl == "test.etown.cn" || RequestUrl == "admin.etown.cn" || RequestUrl == "admin.vctrip.com") { Response.Redirect("/Manage/index1.html"); } else { Response.Redirect("/admin/"); } } } } //判断商户ID(域名未绑定) if (comid != 0) { B2b_company com = B2bCompanyData.GetAllComMsg(comid); B2b_company_saleset comsetinfo = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (com != null) { Com_name = com.Com_name; Scenic_name = com.Scenic_name; Scenic_intro = com.B2bcompanyinfo.Scenic_intro; if (comsetinfo != null) { if (comsetinfo.Logo != "") { FileUploadModel comlogo = new FileUploadData().GetFileById(int.Parse(comsetinfo.Logo)); if (comlogo != null) { Logourl = "<img src=\"" + fileUrl + comlogo.Relativepath + "\" alt=\"" + Scenic_name + "\" height=\"80\" id=\"imglogo\" />"; } } else { Logourl = ""; } Service_Phone = comsetinfo.Service_Phone; if (Service_Phone != "") { Service_Phone = "客服电话:" + Service_Phone; } Copyright = comsetinfo.Copyright; } } } else { //如果没有商户ID(域名未绑定) 则跳转管理登陆页面。 Response.Redirect("/Manage/index1.html"); } }
public int viewtop = 1; //头部及左侧相关显示控制 protected void Page_Load(object sender, EventArgs e) { Request.ValidateInput(); if (Session["AccountId"] != null) { AccountId = Session["AccountId"].ToString(); AccountName = Session["AccountName"].ToString(); AccountCard = Session["AccountCard"].ToString(); Today = DateTime.Now.ToString("yyyy-MM-dd"); } comid = Request["comid"].ConvertTo <int>(0); proid = Request["proid"].ConvertTo <string>(""); orderid = Request["orderid"].ConvertTo <int>(0); ordertype = Request["ordertype"].ConvertTo <string>("1"); RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower(); if (orderid != 0) { B2bOrderData dataorder = new B2bOrderData(); B2b_order modelb2border = dataorder.GetOrderById(orderid); if (modelb2border != null) { proid = modelb2border.Pro_id.ToString(); } } if (proid != "") { B2b_com_pro pro = new B2bComProData().GetProById(proid); if (pro != null) { //如果是 云顶旅游大巴的 不显示头部 if (pro.Projectid == 2179) { viewtop = 0; Scenic_name = pro.Pro_name; Com_name = pro.Pro_name; } //绿野 不显示头部 if (pro.Com_id == 2553) { viewtop = 0; } } } //根据域名读取商户ID,如果没有绑定域名直接跳转后台 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)); } } //判断商户ID(域名未绑定) if (comid != 0) { B2b_company com = B2bCompanyData.GetAllComMsg(comid); B2b_company_saleset comsetinfo = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (com != null) { if (Com_name == "") { Com_name = com.Com_name; } if (Scenic_name == "") { Scenic_name = com.Scenic_name; } Scenic_intro = com.B2bcompanyinfo.Scenic_intro; if (comsetinfo != null) { Logourl = comsetinfo.Logo; if (Logourl != "") { FileUploadModel url = new FileUploadData().GetFileById(int.Parse(Logourl)); if (url != null) { Logourl = "<img src=\"" + fileUrl + url.Relativepath + "\" alt=\"" + Scenic_name + "\" height=\"24\" />"; } } Service_Phone = comsetinfo.Service_Phone; if (Service_Phone != "") { Service_Phone = "客服电话:" + Service_Phone; } Copyright = comsetinfo.Copyright; } } } else { //如果没有商户ID(域名未绑定) 则跳转管理登陆页面。 // Response.Redirect("/Manage/index1.html"); } }
public string projectimgurl = ""; //项目图片 protected void Page_Load(object sender, EventArgs e) { DateTime checkindate1 = Request["indate"].ConvertTo <DateTime>(); checkindate = checkindate1.ToString("yyyy-MM-dd"); DateTime checkoutdate1 = Request["outdate"].ConvertTo <DateTime>(); checkoutdate = checkoutdate1.ToString("yyyy-MM-dd"); bookdaynum = (checkoutdate1 - checkindate1).Days; buyuid = Request["buyuid"].ConvertTo <int>(0); tocomid = Request["tocomid"].ConvertTo <int>(0); proid = Request["id"].ConvertTo <int>(0); comid = Request["comid"].ConvertTo <int>(0); bookdaynum = (checkoutdate1 - checkindate1).Days; uid = Request["uid"].ConvertTo <int>(0); //获得房态信息 List <B2b_com_LineGroupDate> list = new B2b_com_LineGroupDateData().GetLineDayGroupDate(checkindate, checkoutdate, proid); if (list.Count > 0) { foreach (B2b_com_LineGroupDate m in list) { singleroom_totalprice += m.Menprice; fangtai += m.Menprice + ","; } if (fangtai.Length > 0) { fangtai = fangtai.Substring(0, fangtai.Length - 1); } } if (proid != 0) { var prodata = new B2bComProData().GetProById(proid.ToString()); if (prodata != null) { comid = prodata.Com_id; B2b_com_project mod = new B2b_com_projectData().GetProject(prodata.Projectid, comid); if (mod != null) { projectimgurl = FileSerivce.GetImgUrl(mod.Projectimg); projectname = mod.Projectname; } } } //从cookie中得到微信号 if (Request.Cookies["openid"] != null) { openid = Request.Cookies["openid"].Value; } B2bCrmData b2b_crm = new B2bCrmData(); if (openid != "") { B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid); if (b2bmodle != null) { Imprest = b2bmodle.Imprest; Integral = b2bmodle.Integral; } } }
public string pricedetail = ""; //价格详情(暂时只有用来描述旅游) protected void Page_Load(object sender, EventArgs e) { //RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower(); string u = Request.ServerVariables["HTTP_USER_AGENT"]; bool bo = detectmobilebrowser.HttpUserAgent(u); if (Request.QueryString["code"] != null) { #region 获取用户openid code = Request.QueryString["code"]; string url = string.Format( "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code", appId, appsecret, code); string returnStr = HttpUtil.Send("", url); var obj = JsonConvert.DeserializeObject <ModelOpenID>(returnStr); url = string.Format( "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={0}&grant_type=refresh_token&refresh_token={1}", appId, obj.refresh_token); returnStr = HttpUtil.Send("", url); obj = JsonConvert.DeserializeObject <ModelOpenID>(returnStr); WriteFile(Server.MapPath("") + "\\Log.txt", obj.access_token); WriteFile(Server.MapPath("") + "\\Log.txt", obj.openid); //url = string.Format( // "https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}", // obj.access_token, obj.openid); //returnStr = HttpUtil.Send("", url); //WriteFile(Server.MapPath("") + "\\Log.txt", returnStr); #endregion /////////////////////////////////////////////////////////////////////////////////////////////// orderid = Request["orderid"].ConvertTo <int>(0); if (orderid != 0) { //根据订单id得到订单信息 B2bOrderData dataorder = new B2bOrderData(); B2b_order modelb2border = dataorder.GetOrderById(orderid); //根据产品id得到产品信息 B2bComProData datapro = new B2bComProData(); B2b_com_pro modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString()); if (modelb2border != null && modelcompro != null) { #region 务类型订单金额 servertype = modelcompro.Server_type; //如果服务类型是“酒店客房”,则根据酒店扩展订单表中房态信息,获取支付金额 if (modelcompro.Server_type == 9) { B2b_order_hotel hotelorder = new B2b_order_hotelData().GetHotelOrderByOrderId(orderid); if (hotelorder != null) { string fangtai = hotelorder.Fangtai; DateTime start_data = hotelorder.Start_date; DateTime end_data = hotelorder.End_date; int bookdaynum = hotelorder.Bookdaynum; decimal everyroomprice = 0; string[] ftstr = fangtai.Split(','); for (int i = 0; i < ftstr.Length; i++) { if (ftstr[i].ConvertTo <decimal>(0) > 0) { everyroomprice += ftstr[i].ConvertTo <decimal>(0); } } price = everyroomprice.ToString(); p_totalprice1 = (modelb2border.U_num * everyroomprice - modelb2border.Integral1 - modelb2border.Imprest1); } else { } } else if (servertype == 2 || servertype == 8)//当地游;跟团游 { string outdate = modelb2border.U_traveldate.ToString("yyyy-MM-dd"); //读取団期价格,根据实际选择的団期报价 B2b_com_LineGroupDate linemode = new B2b_com_LineGroupDateData().GetLineDayGroupDate(DateTime.Parse(outdate), modelcompro.Id); if (linemode != null) { price = linemode.Menprice.ToString(); decimal childreduce = modelcompro.Childreduce; decimal childprice = decimal.Parse(price) - childreduce; if (childprice < 0) { childprice = 0; } pricedetail = modelb2border.U_num + "成人," + modelb2border.Child_u_num + "儿童(成人" + price + "元/人,儿童" + childprice + "元/人)"; p_totalprice1 = (modelb2border.U_num * (linemode.Menprice) + (modelb2border.Child_u_num) * childprice - modelb2border.Integral1 - modelb2border.Imprest1); } } else //票务 { p_totalprice1 = (modelb2border.U_num * modelcompro.Advise_price - modelb2border.Integral1 - modelb2border.Imprest1); price = modelcompro.Advise_price.ToString(); //modelb2border.Pay_price.ToString(); if (price == "0.00" || price == "0") { price = ""; } else { price = CommonFunc.OperTwoDecimal(price); } } #endregion proname = modelcompro.Pro_name; u_name = modelb2border.U_name.Substring(0, 1) + "**"; u_mobile = modelb2border.U_phone.Substring(0, 4) + "****" + modelb2border.U_phone.Substring(modelb2border.U_phone.Length - 3, 3); travel_date = modelb2border.U_traveldate.ToString(); buy_num = modelb2border.U_num; u_youxiaoqi = modelcompro.Pro_start.ToString() + " - " + modelcompro.Pro_end.ToString(); p_totalprice = CommonFunc.OperTwoDecimal(p_totalprice1.ToString()); wxp_totalprice = (p_totalprice1 * 100).ToString("F0"); price = modelb2border.Pay_price.ToString(); price = CommonFunc.OperTwoDecimal(price); comid = modelcompro.Com_id; if (comid != 0) { comName = B2bCompanyData.GetCompany(comid).Com_name; if (bo == false) { Response.Redirect("http://shop" + comid + ".etown.cn"); } } if ((int)modelb2border.Order_state != (int)OrderStatus.WaitPay) { order_status = EnumUtils.GetName((OrderStatus)modelb2border.Order_state); return; } var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (saleset != null) { phone = saleset.Service_Phone; } //写入支付数据库,先判定是否有此订单支付 B2bPayData datapay = new B2bPayData(); B2b_pay modelb2pay = datapay.GetPayByoId(orderid); #region 微信支付 //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中 B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(modelcompro.Com_id); if (model != null) { //商家微信支付的所有参数都存在 if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "") { appId = model.Wx_appid; appsecret = model.Wx_appkey; appkey = model.Wx_paysignkey; mchid = model.Wx_partnerid; } else { return; } } else { return; } //创建支付应答对象 var packageReqHandler = new RequestHandler(Context); //初始化 packageReqHandler.init(); timeStamp = TenpayUtil.getTimestamp(); nonceStr = TenpayUtil.getNoncestr(); //设置package订单参数 string productname = modelcompro.Pro_name.Replace("\"", "").Replace("“", "").Replace("'", "").Replace("‘", "").Replace(";", "").Replace(";", ""); packageReqHandler.setParameter("body", productname); //商品信息 127字符 packageReqHandler.setParameter("appid", appId); packageReqHandler.setParameter("mch_id", mchid); packageReqHandler.setParameter("nonce_str", nonceStr.ToLower()); packageReqHandler.setParameter("notify_url", "http://shop" + modelcompro.Com_id + ".etown.cn/wxpay/backpaynotice.aspx"); packageReqHandler.setParameter("openid", obj.openid); packageReqHandler.setParameter("out_trade_no", orderid.ToString()); //商家订单号 packageReqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.setParameter("total_fee", wxp_totalprice); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.setParameter("trade_type", "JSAPI"); //获取package包 sign = packageReqHandler.CreateMd5Sign("key", appkey); WriteFile(Server.MapPath("") + "\\Log.txt", sign); packageReqHandler.setParameter("sign", sign); string data = packageReqHandler.parseXML(); WriteFile(Server.MapPath("") + "\\Log.txt", data); string prepayXml = HttpUtil.Send(data, "https://api.mch.weixin.qq.com/pay/unifiedorder"); WriteFile(Server.MapPath("") + "\\Log.txt", prepayXml); //获取预支付ID var xdoc = new XmlDocument(); xdoc.LoadXml(prepayXml); XmlNode xn = xdoc.SelectSingleNode("xml"); XmlNodeList xnl = xn.ChildNodes; if (xnl.Count > 7) { prepayId = xnl[7].InnerText; package = string.Format("prepay_id={0}", prepayId); WriteFile(Server.MapPath("") + "\\Log.txt", package); } //设置支付参数 var paySignReqHandler = new RequestHandler(Context); paySignReqHandler.setParameter("appId", appId); paySignReqHandler.setParameter("timeStamp", timeStamp); paySignReqHandler.setParameter("nonceStr", nonceStr); paySignReqHandler.setParameter("package", package); paySignReqHandler.setParameter("signType", "MD5"); paySign = paySignReqHandler.CreateMd5Sign("key", appkey); WriteFile(Server.MapPath("") + "\\Log.txt", paySign); #endregion //订单提交支付信息 if (modelb2pay == null) { B2b_pay eticket = new B2b_pay() { Id = 0, Oid = orderid, Pay_com = "wx", Pay_name = modelb2border.U_name, Pay_phone = modelb2border.U_phone, Total_fee = p_totalprice1, Trade_no = "", Trade_status = "trade_pendpay", Uip = "" }; int payid = datapay.InsertOrUpdate(eticket); } else { //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付 if (modelb2pay.Trade_status != "TRADE_SUCCESS") { //防止金额有所改动 modelb2pay.Pay_com = "wx"; modelb2pay.Total_fee = p_totalprice1; datapay.InsertOrUpdate(modelb2pay); } } } } } }
protected void Page_Load(object sender, EventArgs e) { if (UserHelper.ValidateLogin()) { comid = UserHelper.CurrentCompany.ID; } projectid = Request["projectid"].ConvertTo <int>(0); nowdate = DateTime.Now.ToString("yyyy-MM-dd"); monthdate = DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd"); proid = Request["proid"].ConvertTo <int>(0); servertype = Request["servertype"].ConvertTo <int>(1); if (proid > 0) { int bindingid = new B2bComProData().GetbindingidbyProid(proid); if (bindingid > 0) { new B2bComProData().Getsalenum(bindingid, out limitbuytotalnum, out buynum); } else { new B2bComProData().Getsalenum(proid, out limitbuytotalnum, out buynum); } } //产品主图片 BindHeadPortrait(proid); ShowImgBind(proid); //产品子级图片(多图片)上传 BindChildImg(proid); //获取所属行业 B2b_company_manageuser user = UserHelper.CurrentUser(); B2b_company company = UserHelper.CurrentCompany; var comdata = B2bCompanyData.GetCompany(company.ID); if (comdata != null) { industryid = comdata.Com_type; } //判断公司是否含有项目,不含有的话,添加默认项目 int count = new B2b_com_projectData().GetProjectCountByComId(company.ID); if (count == 0) { B2b_company_info companyinfo = new B2bCompanyInfoData().GetCompanyInfo(company.ID); B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(company.ID.ToString()); B2b_com_project model = new B2b_com_project() { Id = 0, Projectname = company.Com_name, Projectimg = saleset.Logo.ConvertTo <int>(0), Province = companyinfo.Province.ConvertTo <string>(""), City = companyinfo.City, Industryid = company.Com_type, Briefintroduce = companyinfo.Scenic_intro, Address = companyinfo.Scenic_address, Mobile = companyinfo.Tel, Coordinate = "", Serviceintroduce = companyinfo.Serviceinfo, Onlinestate = "1", Comid = company.ID, Createtime = DateTime.Now, Createuserid = 0 }; int result = new B2b_com_projectData().EditProject(model); //设置公司下产品的项目id都改为默认项目id int result2 = new B2bComProData().UpProjectId(company.ID.ToString(), result); } }
public string Pro_name = ""; //产品名称 protected void Page_Load(object sender, EventArgs e) { string u = Request.ServerVariables["HTTP_USER_AGENT"]; bool bo = detectmobilebrowser.HttpUserAgent(u); oid = Request["oid"].ConvertTo <int>(0); evatype = Request["evatype"].ConvertTo <int>(0); 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; } } if (openid != null && openid != "") { //只要传递过来微信ID 直接SESSION Session["Openid"] = openid; } if (comid != 0) { //根据公司id得到公司logo地址和公司名称 title = B2bCompanyData.GetCompany(comid).Com_name; B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (pro != null) { logoimg = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0)); } //获取微信平台端code weixincode = Request["code"].ConvertTo <string>(""); openid = Request["openid"].ConvertTo <string>(""); weixinpass = Request["weixinpass"].ConvertTo <string>(""); GetMemberCard(openid, weixincode, weixinpass, comid);//登陆或得到会员信息 //最后判断登陆 if (AccountId == 0) { Response.Redirect("/h5/order/login.aspx"); } //读取订单 var orderdata = new B2bOrderData(); var orderinfo = orderdata.GetOrderById(oid); if (orderinfo != null) { var prodata = new B2bComProData(); var proinfo = prodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid); if (proinfo != null) { Pro_name = proinfo.Pro_name; if (evatype == 1) { Pro_name = "教练为用户提交教学档案:" + Pro_name + " 预约时间:" + orderinfo.U_traveldate.ToString("yyyy-MM-dd HH:mm"); } } uid = orderinfo.U_id; channelid = orderinfo.channelcoachid; } //权限不匹配 跳转会员登陆页面 if (evatype == 0) { //if (AccountId != uid) //{ // Response.Redirect("/h5/order/login.aspx"); //} } else //如果是 教练评价 客户 //查询渠道是否匹配,可能遇到不针对教练预约 ,暂时不做判定,这样 出现所有教练都有可能对客户进行评价,未指定教练,如何评价 { } } }
public void Page_Load(object sender, EventArgs e) { string u = Request.ServerVariables["HTTP_USER_AGENT"]; bool bo = detectmobilebrowser.HttpUserAgent(u); id = Request["id"].ConvertTo <int>(0); string md5 = Request["md5"].ConvertTo <string>(""); string Returnmd5 = EncryptionHelper.ToMD5(id.ToString() + "lixh1210", "UTF-8"); var orderdata = new B2bOrderData(); var orderinfo = orderdata.GetOrderById(id); if (orderinfo != null) { u_name = orderinfo.U_name; //判断登陆状态 //if (Session["AccountId"] != null) //{ //先判断Session //int AccountId = int.Parse(Session["AccountId"].ToString()); if (Returnmd5 == md5) //必须符合加密的才能打开 { yuyuetime = orderinfo.U_traveldate.ToString("yyyy-MM-dd hh:mm:ss"); var prodata = new B2bComProData(); var proinfo = prodata.GetProById(orderinfo.Pro_id.ToString()); if (proinfo != null) { Pro_name = proinfo.Pro_name; bindiname = proinfo.bookpro_bindname; bindphone = proinfo.bookpro_bindphone; var managedata = new B2bCompanyManagerUserData(); var manageinfo = managedata.GetCompanyUserByPhone(bindphone, proinfo.Com_id); if (manageinfo != null) { bindimg = FileSerivce.GetImgUrl(manageinfo.Headimg); } } } //} } uid = Request["uid"].ConvertTo <int>(0); //获取IP地址 uip = CommonFunc.GetRealIP(); key = Request["key"].ConvertTo <string>(""); if (key != "") { biaoti = key; } proclass = Request["class"].ConvertTo <int>(0); price = Request["price"].ConvertTo <int>(0); if (proclass != 0) { var prodata = new B2bComProData(); var result = prodata.Proclassbyid(proclass); if (result != null) { biaoti = result.Classname; } } //获取随机用户ID if (Request.Cookies["temp_userid"] != null) { userid = Request.Cookies["temp_userid"].Value; } else { userid = Domain_def.HuoQu_Temp_UserId(); //Response.Cookies("userid").val(); HttpCookie cookie = new HttpCookie("temp_userid"); //实例化HttpCookie类并添加值 cookie.Value = userid; cookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(cookie); } buyuid = Request["buyuid"].ConvertTo <int>(0); tocomid = Request["tocomid"].ConvertTo <int>(0); 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; } } if (comid != 0) { //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中 B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(comid); //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b"); if (model != null) { //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c"); //商家微信支付的所有参数都存在 if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "") { //appId = model.Wx_appid; //appsecret = model.Wx_appkey; //appkey = model.Wx_paysignkey; //mchid = model.Wx_partnerid; //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d"); issetfinancepaytype = true; } } 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; } 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)); } } //获取微信平台端code string weixincode = Request["code"].ConvertTo <string>(""); //获取微信号和一次性密码 openid = Request["openid"].ConvertTo <string>(""); string weixinpass = Request["weixinpass"].ConvertTo <string>(""); //获得会员信息 GetCrmInfo(weixincode, openid, weixinpass); } //获取BANNER,及logo if (comid != 0) { //根据公司id得到 直销设置 B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (saleset != null) { logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0)); } } //微信转发访问归属渠道 if (uid != 0)//必须记录转发用户信息才能继续统计 { //判断有转发人的渠道 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); } } } }
protected void Page_Load(object sender, EventArgs e) { int order_no = Int32.Parse(Request.QueryString["out_trade_no"]); //获取订单号 //返回订单号 int orderid = order_no; if (orderid != 0) { //根据订单id得到订单信息 B2bOrderData dataorder = new B2bOrderData(); B2b_order modelb2border = dataorder.GetOrderById(orderid); //根据产品id得到产品信息 B2bComProData datapro = new B2bComProData(); B2b_com_pro modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString()); //生成电子码 int u_num = modelb2border.U_num; int comid = modelcompro.Com_id; RandomCodeData datarandomcode = new RandomCodeData(); RandomCode modelrandomcode = datarandomcode.GetRandomCode();//得到未用随机码对象 //设置取出的电子码状态为1(已使用) modelrandomcode.State = 1; int randomcodeid = datarandomcode.InsertOrUpdate(modelrandomcode); string eticketcode = "9" + comid.ToString() + modelrandomcode.Code.ToString(); string sendstr = ""; //录入电子票列表 B2bEticketData eticketdata = new B2bEticketData(); B2b_eticket eticket = new B2b_eticket() { Id = 0, Com_id = comid, Pro_id = modelcompro.Id, Agent_id = 0,//直销 Pno = eticketcode, E_type = (int)EticketCodeType.ShuZiMa, Pnum = modelb2border.U_num, Use_pnum = modelb2border.U_num, E_proname = modelcompro.Pro_name, E_face_price = modelcompro.Face_price, E_sale_price = modelcompro.Advise_price, E_cost_price = modelcompro.Agentsettle_price, V_state = (int)EticketCodeStatus.NotValidate, Send_state = (int)EticketCodeSendStatus.NotSend, Subdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")) }; int eticketid = eticketdata.InsertOrUpdate(eticket); if (eticketid > 0) { //生成电子码短信,稍后可单独写类或写到数据库中 diveticketcode.InnerText = "电子码生成成功:" + eticketcode; sendstr = "感谢您订购" + modelcompro.Pro_name + modelb2border.U_num + "张" + ",电子码:" + eticketcode + " 有效期至:" + modelcompro.Pro_end.ToString("yyyy-MM-dd"); } else { diveticketcode.InnerText = "电子码生成ERROR"; } } }
public string prodate(string proid) { proid = new B2bComProData().GetProById(proid).Pro_end.ToString("yyyy-MM-dd"); return(proid); }
public string proname(string proid) { proid = new B2bComProData().GetProById(proid).Pro_name; return(proid); }
//str4=电话,str7=预订热线 protected void Page_Load(object sender, EventArgs e) { id = Request["orderid"].ConvertTo <int>(0); B2bOrderData orderdata = new B2bOrderData(); var orderinfo = orderdata.GetOrderById(id); if (orderinfo == null) { Response.Redirect("Order.aspx");//未查询到订单 return; } //订单数量 ordernum = orderinfo.U_num; subtime = orderinfo.U_subdate; B2bEticketData eticketdata = new B2bEticketData(); //已打印数量 printnum = eticketdata.AlreadyPrintNumbyOrderid(id); unprintnum = ordernum - printnum; B2bComProData prodate = new B2bComProData(); var proinfo = prodate.GetProById(orderinfo.Pro_id.ToString()); if (proinfo != null) { comid_temp = proinfo.Com_id; proname = proinfo.Pro_name; Face_price = proinfo.Face_price; pro_end = proinfo.Pro_end.ToString("yyyy年MM月dd日"); pro_start = proinfo.Pro_start.ToString("yyyy年MM月dd日"); Pro_Remark = "备注: " + proinfo.pro_note; B2b_com_projectData projectdate = new B2b_com_projectData(); var projectinfo = projectdate.GetProject(proinfo.Projectid, proinfo.Com_id); if (projectinfo != null) { address = "地址:" + projectinfo.Address; mobile = projectinfo.Mobile; //proname = projectinfo.Projectname + proname;//不增加项目信息 } if (orderinfo.Agentid != 0) { var agentinfo = AgentCompanyData.GetAgentByid(orderinfo.Agentid); if (agentinfo != null) { mobile = agentinfo.Mobile;//读取分销电话 agentcompany = agentinfo.Company; } } } B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; } if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); if (Agentid != orderinfo.Agentid) { //订单与分销不匹配 Response.Redirect("order.aspx"); } Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { yufukuan = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元"; Warrant_type = agenginfo.Warrant_type; if (Warrant_type == 1) { Warrant_type_str = "销售扣款"; } if (Warrant_type == 2) { Warrant_type_str = "验证扣款"; } } else { Response.Redirect("/Agent/Default.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { string sp_billno = Request["order_no"]; string product_name = Request["product_name"]; string order_price = Request["order_price"];; string remarkexplain = Request["remarkexplain"]; string bank_type_value = Request["bank_type_value"].ConvertTo <string>("DEFAULT"); double money = 0; if (null == Request["order_price"]) { Response.Write("支付金额错误!"); Response.End(); return; } try { money = Convert.ToDouble(order_price); } catch { Response.Write("支付金额格式错误!"); Response.End(); return; } if (null == sp_billno) { ////生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一 //sp_billno = DateTime.Now.ToString("HHmmss") + TenpayUtil.BuildRandomStr(4); Response.Write("订单编号错误!"); Response.End(); return; } else { sp_billno = Request["order_no"].ToString(); } //根据订单id得到订单信息 B2bOrderData dataorder = new B2bOrderData(); B2b_order modelb2border = dataorder.GetOrderById(sp_billno.ConvertTo <int>(0)); if (modelb2border == null) { Response.Write("订单信息获取错误!"); Response.End(); return; } //根据产品id得到产品信息 B2bComProData datapro = new B2bComProData(); B2b_com_pro modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString()); if (modelcompro == null) { Response.Write("产品信息错误!"); Response.End(); return; } if (modelb2border != null && modelcompro != null) { //写入支付数据库,先判定是否有此订单支付 //根据订单id得到订单信息 B2bPayData datapay = new B2bPayData(); B2b_pay modelb2pay = datapay.GetPayByoId(sp_billno.ConvertTo <int>(0)); if (modelb2pay != null) { //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付 if (modelb2pay.Trade_status == "TRADE_SUCCESS") { Response.Write("订单已经支付过!"); Response.End(); return; } } #region 获得财付通支付参数 tenpay_id,tenpay_key //根据产品判断商家是否含有自己的财付通支付: //a.含有的话支付到商家; //b.没有的话支付到平台财付通账户(易城账户,公司id=106) string tenpay_id = ""; string tenpay_key = ""; B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(modelcompro.Com_id); if (model != null) { //商家财付通支付的所有参数都存在 if (model.Tenpay_id != "" && model.Tenpay_key != "") { tenpay_id = model.Tenpay_id; tenpay_key = model.Tenpay_key; } else { model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(106); if (model == null) { Response.Write("商户财付通信息设置不完全!"); Response.End(); return; } else { //商家财付通支付的所有参数都存在 if (model.Tenpay_id != "" && model.Tenpay_key != "") { tenpay_id = model.Tenpay_id; tenpay_key = model.Tenpay_key; } else { Response.Write("商户财付通信息设置不完全!!"); Response.End(); return; } } } } else { model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(106); if (model == null) { Response.Write("商户财付通信息设置不完全!"); Response.End(); return; } else { //商家财付通支付的所有参数都存在 if (model.Tenpay_id != "" && model.Tenpay_key != "") { tenpay_id = model.Tenpay_id; tenpay_key = model.Tenpay_key; } else { Response.Write("商户财付通信息设置不完全!!"); Response.End(); return; } } } #endregion if (modelb2pay == null) { B2b_pay eticket = new B2b_pay() { Id = 0, Oid = sp_billno.ConvertTo <int>(0), Pay_com = "mtenpay", Pay_name = modelb2border.U_name, Pay_phone = modelb2border.U_phone, Total_fee = (decimal)modelb2border.Pay_price * modelb2border.U_num + modelb2border.Express - modelb2border.Integral1 - modelb2border.Imprest1, Trade_no = "", Trade_status = "trade_pendpay", Uip = "", comid = model.Com_id }; int payid = datapay.InsertOrUpdate(eticket); } else { //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付 if (modelb2pay.Trade_status != "TRADE_SUCCESS") { //防止金额有所改动 modelb2pay.comid = model.Com_id; modelb2pay.Pay_com = "mtenpay"; modelb2pay.Total_fee = (decimal)modelb2border.Pay_price * modelb2border.U_num + modelb2border.Express - modelb2border.Integral1 - modelb2border.Imprest1; datapay.InsertOrUpdate(modelb2pay); } else { Response.Write("订单已经支付过!"); Response.End(); return; } } //创建RequestHandler实例 RequestHandler reqHandler = new RequestHandler(Context); //初始化 reqHandler.init(); //设置密钥 reqHandler.setKey(tenpay_key); reqHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm"); //----------------------------- //设置支付参数 //----------------------------- reqHandler.setParameter("partner", tenpay_id); //商户号 reqHandler.setParameter("out_trade_no", sp_billno); //商家订单号 reqHandler.setParameter("total_fee", (money * 100).ToString()); //商品金额,以分为单位 reqHandler.setParameter("return_url", "http://shop" + modelcompro.Com_id.ToString() + ".etown.cn/tenpay/payReturnUrl.aspx"); //交易完成后跳转的URL reqHandler.setParameter("notify_url", "http://shop" + modelcompro.Com_id.ToString() + ".etown.cn/tenpay/payNotifyUrl.aspx"); //接收财付通通知的URL reqHandler.setParameter("body", remarkexplain); //商品描述 reqHandler.setParameter("bank_type", bank_type_value); //银行类型(中介担保时此参数无效) reqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP reqHandler.setParameter("fee_type", "1"); //币种,1人民币 reqHandler.setParameter("subject", product_name); //商品名称(中介交易时必填) //系统可选参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); //业务可选参数 reqHandler.setParameter("attach", ""); //附加数据,原样返回 reqHandler.setParameter("product_fee", "0"); //商品费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("transport_fee", "0"); //物流费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //订单生成时间,格式为yyyymmddhhmmss reqHandler.setParameter("time_expire", ""); //订单失效时间,格式为yyyymmddhhmmss reqHandler.setParameter("buyer_id", ""); //买方财付通账号 reqHandler.setParameter("goods_tag", ""); //商品标记 reqHandler.setParameter("trade_mode", "1"); //交易模式,1即时到账(默认),2中介担保,3后台选择(买家进支付中心列表选择) reqHandler.setParameter("transport_desc", ""); //物流说明 reqHandler.setParameter("trans_type", "1"); //交易类型,1实物交易,2虚拟交易 reqHandler.setParameter("agentid", ""); //平台ID reqHandler.setParameter("agent_type", ""); //代理模式,0无代理(默认),1表示卡易售模式,2表示网店模式 reqHandler.setParameter("seller_id", ""); //卖家商户号,为空则等同于partner //获取请求带参数的url string requestUrl = reqHandler.getRequestURL(); //获取debug信息,建议把请求和debug信息写入日志,方便定位问题 string debuginfo = reqHandler.getDebugInfo(); //Response.Write("<br/>requestUrl:" + requestUrl + "<br/>"); //Response.Write("<br/>debuginfo:" + debuginfo + "<br/>"); //Get的实现方式 string a_link = "<a target=\"_blank\" href=\"" + requestUrl + "\">" + "财付通支付" + "</a>"; //Response.Write(a_link); Response.Redirect(requestUrl); //post实现方式 /* Response.Write("<form method=\"post\" action=\"" + reqHandler.getGateUrl() + "\" >\n"); * Hashtable ht = reqHandler.getAllParameters(); * foreach (DictionaryEntry de in ht) * { * Response.Write("<input type=\"hidden\" name=\"" + de.Key + "\" value=\"" + de.Value + "\" >\n"); * } * Response.Write("<input type=\"submit\" value=\"财付通支付\" >\n</form>\n");*/ } }
public void Page_Load(object sender, EventArgs e) { string u = Request.ServerVariables["HTTP_USER_AGENT"]; bool bo = detectmobilebrowser.HttpUserAgent(u); uid = Request["uid"].ConvertTo <int>(0); MasterId = Request["MasterId"].ConvertTo <int>(0); //获取IP地址 uip = CommonFunc.GetRealIP(); id = Request["id"].ConvertTo <int>(0); nowdate = DateTime.Now.ToString("yyyy-MM-dd"); nowtoday = DateTime.Now; buyuid = Request["buyuid"].ConvertTo <int>(0); tocomid = Request["tocomid"].ConvertTo <int>(0); //获取随机用户ID if (Request.Cookies["temp_userid"] != null) { userid = Request.Cookies["temp_userid"].Value; } else { userid = Domain_def.HuoQu_Temp_UserId(); //Response.Cookies("userid").val(); HttpCookie cookie = new HttpCookie("temp_userid"); //实例化HttpCookie类并添加值 cookie.Value = userid; cookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(cookie); } if (id != 0) { B2b_com_pro pro = new B2bComProData().GetProById(id.ToString()); if (pro != null) { channelcoachid = new MemberChannelData().GetChannelidbymanageuserid(MasterId, pro.Com_id); if (pro.Server_type == 13) { //如果 产品为教练产品 if (channelcoachid == 0) { //当未选择教练 则 跳转到教练页面 Response.Redirect("/h5/coachList.aspx?come=" + id); } } Ispanicbuy = pro.Ispanicbuy; //是否抢购或限购 Limitbuytotalnum = pro.Limitbuytotalnum; //限购数量 bindname = pro.bookpro_bindname; bindphone = pro.bookpro_bindphone; manyspeci = pro.Manyspeci; Wrentserver = pro.Wrentserver; //如果多规格读取规格 if (manyspeci == 1) { gglist = new B2b_com_pro_SpeciData().Getgglist(pro.Id); } //对默认只显示预约电话进行 if (pro.Server_type == 12 || pro.Server_type == 13) { //当时预约产品就先设定显示预约电话 view_phone = 1; //先判断渠道来路,如果没有渠道则安默认,如果有来路渠道,则显示来路渠道 if (MasterId != 0) { B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId); if (manageruser != null) { bindname = manageruser.Employeename; bindphone = manageruser.Tel; } } //判断 绑定渠道电话 与 访问来的渠道电话相同 则 显示电话,并显示预订 if (bindphone == pro.bookpro_bindphone) { view_phone = 2; } //如果为教练产品,显示订购和 和图像 不显示电话 if (pro.Server_type == 13) { view_phone = 3; } } //通过 显示渠道的电话 来查找头像 B2b_company_manageuser manageruser_temp = new B2bCompanyManagerUserData().GetCompanyUserByPhone(bindphone, pro.Com_id); if (manageruser_temp != null) { channleimg = FileSerivce.GetImgUrl(manageruser_temp.Headimg); if (channleimg == "/Images/defaultThumb.png") { channleimg = ""; } } //查询相关项目名称 var proprojectdata = new B2b_com_projectData(); var proprejectinfo = proprojectdata.GetProject(pro.Projectid, pro.Com_id); if (proprejectinfo != null) { projectname = proprejectinfo.Projectname; Coordinate = proprejectinfo.Coordinate; Address = proprejectinfo.Address; } projectname = proprojectdata.GetProjectNameByid(pro.Projectid); //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中 B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(pro.Com_id); //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b"); if (model != null) { //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c"); //商家微信支付的所有参数都存在 if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "") { //appId = model.Wx_appid; //appsecret = model.Wx_appkey; //appkey = model.Wx_paysignkey; //mchid = model.Wx_partnerid; //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d"); issetfinancepaytype = true; } } //票务产品,判断 是否抢购/限购,是的话 作废超时未支付订单,完成回滚操作 if (pro_servertype == 1) { if (pro.Ispanicbuy == 1 || pro.Ispanicbuy == 2) { int rs = new B2bComProData().CancelOvertimeOrder(pro); } } iscanbook = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态 pro_servertype = pro.Server_type; pickuppoint = pro.pickuppoint; dropoffpoint = pro.dropoffpoint; childreduce = pro.Childreduce; if (pro.Ispanicbuy == 1) { panic_begintime = pro.Panic_begintime; panicbuy_endtime = pro.Panicbuy_endtime; TimeSpan tss = pro.Panic_begintime - nowtoday; var day = tss.Days * 24 * 3600;; //这是相差的天数 var h = tss.Hours * 3600; //这是相差的小时数, var m = tss.Minutes * 60; var s = tss.Seconds; shijiacha = day + h + m + s; } projectid = pro.Projectid; comid = pro.Com_id; pro_name = pro.Pro_name; price = pro.Advise_price; face_price = pro.Face_price; limitbuytotalnum = pro.Limitbuytotalnum; imgurl = FileSerivce.GetImgUrl(pro.Imgurl); //如果含有规格读取规格价格中最低价 if (manyspeci == 1) { if (gglist != null) { price = 0; face_price = 0; for (int i = 0; i < gglist.Count(); i++) { if (gglist[i].speci_advise_price != 0) { if (price == 0 || price > gglist[i].speci_advise_price) { price = gglist[i].speci_advise_price; face_price = gglist[i].speci_face_price; } } } } } if (price == 0) { price = 0; } else { CommonFunc.OperTwoDecimal(price.ToString()); //price = price.IndexOf(".") != -1 ? price.Substring(0, price.IndexOf(".")) : price; } if (face_price != 0) { CommonFunc.OperTwoDecimal(face_price.ToString()); } nowdate = DateTime.Now.ToString("yyyy-MM-dd"); if (pro.Service_Contain != "") { sumaryend = pro.Service_Contain; } if (pro.Service_NotContain != "") { sumaryend = sumaryend + "</br> " + pro.Service_NotContain; } if (pro.Precautions != "") { sumaryend = sumaryend + "</br> " + pro.Precautions; } Server_type = pro.Server_type; bookpro_ispay = pro.bookpro_ispay; //如果服务类型是 票务; 则备注信息中 显示 电子码使用限制 if (pro.Server_type == 1) { if (pro.Iscanuseonsameday == 0)//电子码当天不可用 { youxianshiduan = "此产品当天预订不可用"; } if (pro.Iscanuseonsameday == 1)//电子码当天可用 { youxianshiduan = "此产品当天预订可用"; } if (pro.Iscanuseonsameday == 2)//电子码出票2小时内不可用 { youxianshiduan = "此产品出票2小时内不可用"; } } remark = pro.Pro_Remark; pro_num = pro.Pro_number; if (pro_num == 0) { pro_max = 100; pro_min = 1; } else { pro_min = 1; pro_max = pro_num; } pro_explain = pro.Pro_explain; #region 产品有效期判定(微信模板--门票订单预订成功通知 中也有用到) provalidatemethod = pro.ProValidateMethod; //判断 1按产品有效期,2指定有效期 appointdate = pro.Appointdata; //1=一星期,,2=1个月,3=3个月,4=6个月,5=一年 iscanuseonsameday = pro.Iscanuseonsameday; //1当天可用,0当天不可用 pro_end = pro.Pro_end; pro_end_str = pro.Pro_end.AddMonths(-1).ToString("yyyy,MM,dd"); //返回有效期 pro_youxiaoqi = new B2bComProData().GetPro_Youxiaoqi(pro.Pro_start, pro.Pro_end, provalidatemethod, appointdate, iscanuseonsameday); #endregion //如果是 教练产品 根据教练信息 获取教练 上班时间 if (pro.Server_type == 13 || pro.Server_type == 12) { //必须是教练产品 if (MasterId != 0) //必须有教练参数 { B2b_company_manageuser manageruser = B2bCompanyManagerUserData.GetUser(MasterId); if (manageruser != null) { if (manageruser.Workdays != "") { if (manageruser.worktimestar != 0) { if (manageruser.worktimestar < manageruser.worktimeend) { for (var i = manageruser.worktimestar; i < manageruser.worktimeend; i++) { workh += "<option value=\"" + i + "\">" + i + "点</option>"; } } else { var day1 = 24 - manageruser.worktimestar; var day2 = manageruser.worktimeend; var day3 = day1 + day2; for (var i = 0; i > day3; i++) { if (i > day1) { workh += "<option value=\"" + (manageruser.worktimestar + i) + "\">" + (manageruser.worktimestar + i) + "点</option>"; } else { workh += "<option value=\"" + (manageruser.worktimestar - i) + "\">" + (manageruser.worktimestar - i) + "点</option>"; } } } } if (!manageruser.Workdays.Contains("2")) //检验不含周一 { DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))); //本周周一 //初始日期为今天,到产品有效期结束 增加一周(7天)方式 for (var i = startWeek; i < pro_end; i.AddDays(7)) { nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],"; i = i.AddDays(7); } } if (!manageruser.Workdays.Contains("3")) //检验不含周二 { DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(1); //本周周二 //初始日期为今天,到产品有效期结束 增加一周(7天)方式 for (var i = startWeek; i < pro_end; i.AddDays(7)) { nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],"; i = i.AddDays(7); } } if (!manageruser.Workdays.Contains("4")) //检验不含周3 { DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(2); //本周周3 //初始日期为今天,到产品有效期结束 增加一周(7天)方式 for (var i = startWeek; i < pro_end; i.AddDays(7)) { nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],"; i = i.AddDays(7); } } if (!manageruser.Workdays.Contains("5")) //检验不含周4 { DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(3); //本周周4 //初始日期为今天,到产品有效期结束 增加一周(7天)方式 for (var i = startWeek; i < pro_end; i.AddDays(7)) { nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],"; i = i.AddDays(7); } } if (!manageruser.Workdays.Contains("6")) //检验不含周5 { DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(4); //本周周5 //初始日期为今天,到产品有效期结束 增加一周(7天)方式 for (var i = startWeek; i < pro_end; i.AddDays(7)) { nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],"; i = i.AddDays(7); } } if (!manageruser.Workdays.Contains("7")) //检验不含周6 { DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(5); //本周周6 //初始日期为今天,到产品有效期结束 增加一周(7天)方式 for (var i = startWeek; i < pro_end; i.AddDays(7)) { nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],"; i = i.AddDays(7); } } if (!manageruser.Workdays.Contains("1")) //检验不含周日 { DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays(1 - Convert.ToInt32(dt.DayOfWeek.ToString("d"))).AddDays(6); //本周周日 //初始日期为今天,到产品有效期结束 增加一周(7天)方式 for (var i = startWeek; i < pro_end; i.AddDays(7)) { nowork += "[" + i.Month + "," + i.Day + "," + i.Year + "],"; i = i.AddDays(7); } } } } } } } var commodel = B2bCompanyData.GetCompany(comid); if (commodel != null) { if (commodel.B2bcompanyinfo != null) { Wxfocus_url = commodel.B2bcompanyinfo.Wxfocus_url; Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;; } } var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (saleset != null) { phone = saleset.Service_Phone; } //查询项目电话,如果有项目电话调取项目电话 var projectdata = new B2b_com_projectData(); var projectmodel = projectdata.GetProject(projectid, comid); if (projectmodel != null) { if (projectmodel.Mobile != "") { phone = projectmodel.Mobile; } } //从cookie中得到微信号 if (Request.Cookies["openid"] != null) { openid = Request.Cookies["openid"].Value; } B2bCrmData b2b_crm = new B2bCrmData(); if (openid != "") { B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid); if (b2bmodle != null) { Imprest = b2bmodle.Imprest; Integral = b2bmodle.Integral; } } } if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid { //先通过正则表达式获取COMid comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString()); } if (comid == 0)//如果非标准格式,查询 是否有绑定的域名 { var wxdomain = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl); if (wxdomain != null) { comid = wxdomain.Comid; } } if (comid != 0) { 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; } 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)); } } //获取微信平台端code string weixincode = Request["code"].ConvertTo <string>(""); //获取微信号和一次性密码 openid = Request["openid"].ConvertTo <string>(""); string weixinpass = Request["weixinpass"].ConvertTo <string>(""); //获得会员信息 GetCrmInfo(weixincode, openid, weixinpass); } //获取BANNER,及logo if (comid != 0) { //根据公司id得到 直销设置 B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (saleset != null) { logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0)); } } //微信转发访问归属渠道 if (uid != 0)//必须记录转发用户信息才能继续统计 { //判断有转发人的渠道 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); } } } }
public string userid = "0";//用户临时 Uid 或 实际Uid public void Page_Load(object sender, EventArgs e) { string u = Request.ServerVariables["HTTP_USER_AGENT"]; bool bo = detectmobilebrowser.HttpUserAgent(u); uid = Request["uid"].ConvertTo <int>(0); //获取IP地址 uip = CommonFunc.GetRealIP(); key = Request["key"].ConvertTo <string>(""); if (key != "") { biaoti = key; } proclass = Request["class"].ConvertTo <int>(0); price = Request["price"].ConvertTo <int>(0); //获取随机用户ID if (Request.Cookies["temp_userid"] != null) { userid = Request.Cookies["temp_userid"].Value; } else { userid = Domain_def.HuoQu_Temp_UserId(); //Response.Cookies("userid").val(); HttpCookie cookie = new HttpCookie("temp_userid"); //实例化HttpCookie类并添加值 cookie.Value = userid; cookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(cookie); } if (proclass != 0) { var prodata = new B2bComProData(); var result = prodata.Proclassbyid(proclass); if (result != null) { biaoti = result.Classname; } } buyuid = Request["buyuid"].ConvertTo <int>(0); tocomid = Request["tocomid"].ConvertTo <int>(0); 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; } } if (comid != 0) { 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; } 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)); } } //获取微信平台端code string weixincode = Request["code"].ConvertTo <string>(""); //获取微信号和一次性密码 openid = Request["openid"].ConvertTo <string>(""); string weixinpass = Request["weixinpass"].ConvertTo <string>(""); //获得会员信息 GetCrmInfo(weixincode, openid, weixinpass); } //获取BANNER,及logo if (comid != 0) { var imagedata = new B2bCompanyImageData(); int totalcount = 0; List <B2b_company_image> list = imagedata.PageGetimageList(comid, 2, out totalcount); if (list != null) { for (int i = 0; i < totalcount; i++) { bannerimg = FileSerivce.GetImgUrl(list[i].Imgurl); bannerlink = list[i].Linkurl; bannertitle = list[i].Title; } } //根据公司id得到 直销设置 B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (saleset != null) { logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0)); } //读取首页栏目,只读取前10个栏目,太多影响打开 var shopmenudata = new B2bCompanyMenuData(); menulist = shopmenudata.GetMenuList(comid, 1, 10, out menutotalcount, 1); if (menulist != null) { for (int i = 0; i < menutotalcount; i++) { menulist[i].Imgurl_address = FileSerivce.GetImgUrl(menulist[i].Imgurl); } } } //微信转发访问归属渠道 if (uid != 0)//必须记录转发用户信息才能继续统计 { //判断有转发人的渠道 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); } } } }
protected void Page_Load(object sender, EventArgs e) { Request.ValidateInput(); string u = Request.ServerVariables["HTTP_USER_AGENT"]; //bool bo = detectmobilebrowser.HttpUserAgent(u); proclass = Request["proclass"].ConvertTo <int>(0); uid = Request["uid"].ConvertTo <int>(0); //获取IP地址 uip = CommonFunc.GetRealIP(); buyuid = Request["buyuid"].ConvertTo <int>(0); tocomid = Request["tocomid"].ConvertTo <int>(0); projectid = Request["id"].ConvertTo <int>(0); pno = Request["pno"].ConvertTo <string>(""); string pno1 = EncryptionHelper.EticketPnoDES(pno, 1);//解密 var B2bEticketdata = new B2bEticketData(); var eticketinfo = B2bEticketdata.GetEticketDetail(pno1); if (eticketinfo != null) { comid = eticketinfo.Com_id; usepnonum = eticketinfo.Use_pnum; } if (comid == 0) { if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid { comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl)); } else { B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl); if (companyinfo != null) { comid = companyinfo.Com_id; } } } //微信转发访问归属渠道 if (uid != 0)//必须记录转发用户信息才能继续统计 { //判断有转发人的渠道 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); } } } //根据项目id得到项目信息 if (projectid != 0) { B2b_com_project mod = new B2b_com_projectData().GetProject(projectid, comid); if (mod != null) { projectname = mod.Projectname; projectimgurl = FileSerivce.GetImgUrl(mod.Projectimg); projectbrief = mod.Briefintroduce; } B2bComProData prodata1 = new B2bComProData(); var prohotel = prodata1.Selectpro_hotel(comid, projectid); if (prohotel == 1) { // Response.Redirect("hotel/hotelshow.aspx?projectid=" + projectid + "&id=" + comid + "&uid =" + uid + "&buyuid=" + buyuid + "&tocomid=" + tocomid + " "); } } if (comid != 0) { B2b_company companyinfo = B2bCompanyData.GetCompany(comid); B2bCompanyInfoData info = new B2bCompanyInfoData(); if (companyinfo != null) { comName = companyinfo.Com_name; if (comName.Length >= 9) { comName = comName.Substring(0, 9) + ".."; } remark = info.GetCompanyInfo(comid).Scenic_intro + " <a style=\"color:#1a9ed9\" href=\"OrderinfoTitle.aspx?id=" + comid + "\">(查看全部)</a>"; if (remark.Length > 42) { remark = remark.Substring(0, 42) + " <a style=\"color:#1a9ed9\" href=\"OrderinfoTitle.aspx?id=" + comid + "\">(查看全部)</a>"; } if (companyinfo.B2bcompanyinfo != null) { Wxfocus_url = companyinfo.B2bcompanyinfo.Wxfocus_url; Wxfocus_author = companyinfo.B2bcompanyinfo.Wxfocus_author;; } } B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString()); if (saleset != null) { if (saleset.Smalllogo != null && saleset.Smalllogo != "") { headPortraitImgSrc = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0)); } } } //------------------------------新添加代码(主要目的就是获取微信号使用户处于登录状态以及判断用户转发时引发的微信号混乱问题)=========================== string weixincode = Request["code"].ConvertTo <string>(""); if (weixincode == "")//未认证微信 { openid = Request["openid"].ConvertTo <string>(""); weixinpass = Request["weixinpass"].ConvertTo <string>(""); int questtype = 1; //1=一次性密码验证 DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的) } else//已认证微信 { int questtype = 2; //1=微信授权验证 DealUserinfo1("", weixincode, comid, questtype); //获取微信号;使用户处于登录状态 } }