/// <summary> /// 微信发送模板消息 /// </summary> public void SendTemplateMessageTest_hg() { // 您好,已为您成功预约上门服务。 //项目:高级美甲 //时间:2015年10月1日14:00~16:00 //技师:志玲 //费用:98元 //地址:西安市雁塔区曲江金地湖城大境 //2015年9月28日 16:36 // {{first.DATA}} //客户姓名:{{keyword1.DATA}} //联系电话:{{keyword2.DATA}} //上门时间:{{keyword3.DATA}} //支付信息:{{keyword4.DATA}} //服务地址:{{keyword5.DATA}} //{{remark.DATA}} // 你好,你收到一个新订单 //客户姓名:张三丰 //联系电话:13515812621 //上门时间:2015年5月26日 12:00 //支付信息:微信支付 ¥200.00 //服务地址:上海市浦东新区环林西路 //请联系你的客户,并及时提供服务 int number = int.Parse(Request.QueryString["kk"]); BLL.HG.Hg_list bb = new BLL.HG.Hg_list(); Model.HG.A_HG_new_order modle = bb.getorder_(Request.QueryString["order"]); var openId = modle.Openid_; //换成已经关注用户的openId var templateId = "6oFH4updt21Zfwbks6O7erhZRlOI6jS3Yju8l9qFsw4"; //换成已经在微信后台添加的模板Id var accessToken = Token(); var testData = new //TestTemplateData() { first = new TemplateDataItem("护理服务支付成功"), keyword1 = new TemplateDataItem(modle.Name_), keyword2 = new TemplateDataItem(modle.Tel_), keyword3 = new TemplateDataItem(modle.Time_), keyword4 = new TemplateDataItem("微信支付:" + (modle.total).ToString() + "元"), keyword5 = new TemplateDataItem(modle.Adress), remark = new TemplateDataItem("请保持电话通畅,服务人员会和您取得联系,提供快捷舒心的服务!") }; var result = Senparc.Weixin.MP.AdvancedAPIs.TemplateApi.SendTemplateMessage(accessToken, openId, templateId, "http://www.hugongll.com/hugongll/order.aspx", testData); var openIds = "oZg9IwiZ4xGUBDtjT3lvrB4JV9Vo"; //换成已经关注用户的openId templateId = "6oFH4updt21Zfwbks6O7erhZRlOI6jS3Yju8l9qFsw4"; //换成已经在微信后台添加的模板Id accessToken = Token(); testData = new //TestTemplateData() { first = new TemplateDataItem("新订单提醒(管理通知)"), keyword1 = new TemplateDataItem(modle.Name_), keyword2 = new TemplateDataItem(modle.Tel_), keyword3 = new TemplateDataItem(modle.Time_), keyword4 = new TemplateDataItem("微信支付:" + (modle.total).ToString() + "元"), keyword5 = new TemplateDataItem(modle.Adress), remark = new TemplateDataItem("请与以上用户联系,并回访") }; result = Senparc.Weixin.MP.AdvancedAPIs.TemplateApi.SendTemplateMessage(accessToken, openIds, templateId, "http://www.hugongll.com/hugongll/order.aspx", testData); }
protected void Page_Load(object sender, EventArgs e) { order_number = Request.QueryString["orderdd"]; BLL.HG.Hg_list order = new BLL.HG.Hg_list(); Model.HG.HG_order model = order.Getorder(order_number); name = model.Nursing_name; tel = model.Nursing_tel; nur_sex = model.Nursing_sex; total = model.Total.ToString(); Status_order = model.Status_order; Str_sm = model.str_sm; server_time = model.Service_time; server_day = model.Service_day; by_age = model.By_age; by_name = model.By_name; by_sex = model.By_sex; by_care = model.By_care; by_adress = model.By_adress; HUli_type = model.HUli_type; hg_number = model.Hg_number; BLL.HG.Hg_list bb = new BLL.HG.Hg_list(); Model.HG.HGlist get = bb.Getmodel(int.Parse(hg_number)); hg_name_s = get.Phone; HiddenField1.Value = hg_number; HiddenField2.Value = hg_name_s; }
protected void Page_Load(object sender, EventArgs e) { if (IsFail() == true) { if (Request.QueryString["Fail"].ToString() == "suc") { BLL.HG.Hg_list bb = new BLL.HG.Hg_list(); int number = int.Parse(Request.QueryString["kk"]); order_dd = Request.QueryString["order"]; bb.update_list(number); bb.update("已支付", order_dd); // Update_Hg("预约", number); SendTemplateMessageTest(); SendTemplateMessageTest_hg(); } else { } } if (System.Web.HttpContext.Current.Request.Cookies["open_id"] != null) { open_id = HttpContext.Current.Request.Cookies["open_id"].Value; } }
/// <summary> /// 微信发送模板消息 /// </summary> public void SendTemplateMessageTest() { // 您好,已为您成功预约上门服务。 //项目:高级美甲 //时间:2015年10月1日14:00~16:00 //技师:志玲 //费用:98元 //地址:西安市雁塔区曲江金地湖城大境 //2015年9月28日 16:36 BLL.HG.Hg_list order_T = new BLL.HG.Hg_list(); Model.HG.HG_order model = order_T.Getorder(Request.QueryString["order"]); var openId = HttpContext.Current.Request.Cookies["open_id"].Value; //换成已经关注用户的openId var templateId = "D_WYLHdtug59Q-e1DhPQHrQGB8MurmOhABo44y6qahQ"; //换成已经在微信后台添加的模板Id var accessToken = Token(); var testData = new //TestTemplateData() { first = new TemplateDataItem("您好,预约通知", "#F70D12"), keyword1 = new TemplateDataItem("医院护理"), keyword2 = new TemplateDataItem(model.Service_time), keyword3 = new TemplateDataItem(model.Hg_name, "#0AD690"), keyword4 = new TemplateDataItem((model.Total).ToString() + "元"), keyword5 = new TemplateDataItem(model.By_adress), remark = new TemplateDataItem(DateTime.Now.ToString()) }; var result = Senparc.Weixin.MP.AdvancedAPIs.TemplateApi.SendTemplateMessage(accessToken, openId, templateId, "http://www.hugongll.com/templates/Doc/order.aspx", testData); }
public void ProcessRequest(HttpContext context) { int number = MyCommFun.RequestInt("number"); int page = MyCommFun.RequestInt("page"); string where = MyCommFun.RequestParam("where"); string open_id = MyCommFun.RequestParam("open_idss"); string action = MyCommFun.RequestParam("action"); string mmm = "Hg_number asc"; int recordCount = 0; int ord = MyCommFun.RequestInt("orderid"); string order_123 = MyCommFun.RequestParam("order_123"); string pic_name = MyCommFun.RequestParam("pickname"); if (action == "no_order") { context.Response.ContentType = "text/json"; context.Response.Write(MyCommFun.GetJsonByDataset(No_order(open_id, where))); } else if (action == "delete_order") { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); BLL.HG.Hg_list order = new BLL.HG.Hg_list(); order.DeleteList(ord); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "删除成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else if (action == "pay_update") { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); BLL.HG.Hg_list order = new BLL.HG.Hg_list(); order.update("已支付", order_123); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "更新成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else if (action == "File") { Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); BLL.HG.Hg_list order = new BLL.HG.Hg_list(); WriteTextLog(DateTime.Now); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", "更新成功!"); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { context.Response.Write(MyCommFun.GetJsonByDataset(Hgdata(8, page))); } }
protected void Page_Load(object sender, EventArgs e) { string phone = Request.QueryString["name"]; BLL.HG.Hg_list list = new BLL.HG.Hg_list(); Model.HG.HGlist model = list.Get_xinxi(phone); name = model.Hg_name; HG_number = model.Hg_number; }
protected void Button1_Click(object sender, EventArgs e) { string bb = Request.Form["user"]; string cc = Request.Form["pass"]; BLL.HG.Hg_list order = new BLL.HG.Hg_list(); bool or = order.Login_Hg(bb, cc); if (or == true) { ClientScript.RegisterStartupScript(typeof(string), "温馨提醒", "<script>alert('登陆成功');window.location.href ='List_this.aspx?name=" + bb + "'</script>"); } else { ClientScript.RegisterStartupScript(typeof(string), "温馨提醒", "<script>alert('检查用户名户密码')</script>"); } }
/// <summary> /// 微信发送模板消息 /// </summary> public void SendTemplateMessageTest_hg() { // 您好,已为您成功预约上门服务。 //项目:高级美甲 //时间:2015年10月1日14:00~16:00 //技师:志玲 //费用:98元 //地址:西安市雁塔区曲江金地湖城大境 //2015年9月28日 16:36 // {{first.DATA}} //客户姓名:{{keyword1.DATA}} //联系电话:{{keyword2.DATA}} //上门时间:{{keyword3.DATA}} //支付信息:{{keyword4.DATA}} //服务地址:{{keyword5.DATA}} //{{remark.DATA}} // 你好,你收到一个新订单 //客户姓名:张三丰 //联系电话:13515812621 //上门时间:2015年5月26日 12:00 //支付信息:微信支付 ¥200.00 //服务地址:上海市浦东新区环林西路 //请联系你的客户,并及时提供服务 int number = int.Parse(Request.QueryString["kk"]); BLL.HG.Hg_list order_T = new BLL.HG.Hg_list(); int Hg_number = int.Parse(Request.QueryString["kk"]); Model.HG.HGlist model_hg = order_T.Getmodel(Hg_number); Model.HG.HG_order model = order_T.Getorder(Request.QueryString["order"]); var openId = model_hg.open_id_hg; //换成已经关注用户的openId var templateId = "6oFH4updt21Zfwbks6O7erhZRlOI6jS3Yju8l9qFsw4"; //换成已经在微信后台添加的模板Id var accessToken = Token(); var testData = new //TestTemplateData() { first = new TemplateDataItem("您好,新订单通知"), keyword1 = new TemplateDataItem(model.Nursing_name), keyword2 = new TemplateDataItem(model.Nursing_tel), keyword3 = new TemplateDataItem(model.Service_time), keyword4 = new TemplateDataItem("微信支付:" + (model.Total).ToString() + "元"), keyword5 = new TemplateDataItem(model.By_adress), remark = new TemplateDataItem("请联系你的客户,并及时提供服务") }; var result = Senparc.Weixin.MP.AdvancedAPIs.TemplateApi.SendTemplateMessage(accessToken, openId, templateId, "http://www.hugongll.com/templates/Doc/Hugo_list/Login.aspx", testData); }
protected void bt1_Click(object sender, EventArgs e) { if ((Request.Form["lb1"].Length != 0) && (t1.Text.Length != 0)) { BLL.HG.Hg_list bb = new BLL.HG.Hg_list(); Model.HG.HG_order nn = new Model.HG.HG_order(); string str = Request.Form["lb1"]; string star = Regex.Replace(str, @"[^\d.\d]", ""); nn.Rated_status = int.Parse(star); nn.Rated_hg = t1.Text; nn.Order_dd = Request.QueryString["order_dd"]; if (bb.update_star(nn) == true) { Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('感谢评价,祝您生活愉快!');{location.href='index.aspx'}</script>"); } } else { string script = "<script> alert('请为本次服务做出点评!!') </script>"; Page.RegisterStartupScript("", script); } }
protected void suc_Click(object sender, EventArgs e) { BLL.HG.Hg_list list = new BLL.HG.Hg_list(); int number = int.Parse(Request.QueryString["number"].ToString()); Model.HG.HGlist Hg = list.Getmodel(number); Cookie1(); cookie2(); if ((name.Text == null) || (name.Text == "")) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "js", "<script>alert('联系人不能为空');</script>"); } else if ((text_time.Text == null) || (text_time.Text == "") || (pickdate.Text == null) || (pickdate.Text == "") || (picktime.Text == null) || (picktime.Text == "")) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "js", "<script>alert('预约时间不能为空 ');</script>"); } else if ((telnum.Text == null) || (telnum.Text == "")) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "js", "<script>alert('联系电话不能为空 ');</script>"); } else if ((by_name.Text == null) || (by_name.Text == "") || (by_age.Text == null) || (by_age.Text == "") || (by_adress.Text == "") || (by_adress.Text == null)) { Page.ClientScript.RegisterClientScriptBlock(GetType(), "js", "<script>alert('被护理人信息不能为空 ');</script>"); } else { if (Hg.Hg_st2 == "空闲") { string open_id = ""; if (System.Web.HttpContext.Current.Request.Cookies["open_id"] != null) { open_id = HttpContext.Current.Request.Cookies["open_id"].Value; } Model.HG.HG_order Str = new Model.HG.HG_order(); BLL.HG.Hg_list add = new BLL.HG.Hg_list(); Str.Openid = open_id; Str.Nursing_name = name.Text.Trim().ToString(); Str.Nursing_sex = Select1.Items[Select1.SelectedIndex].Value; Str.Nursing_tel = telnum.Text.Trim().ToString(); Str.By_name = by_name.Text.Trim().ToString(); Str.By_sex = Sel_Test.Items[Sel_Test.SelectedIndex].Value; Str.By_care = By_care.Items[By_care.SelectedIndex].Value; Str.By_age = by_age.Text.Trim().ToString(); Str.By_adress = by_adress.Text.Trim().ToString(); Str.HUli_type = huli_type.Text.Trim(); Str.Hg_name = TextBox2.Text; Str.Hg_number = Request.QueryString["number"].ToString(); Str.Service_time = pickdate.Text + "/" + picktime.Text; Str.Service_day = Request.Form["inp"].ToString(); Str.Status_order = "未完成"; Str.Start_time = DateTime.Now.ToString(); Str.Order_dd = DateTime.Now.Minute + GuidTo16String(); string total = hid.Value; //string bb = ""; //Regex reg = new Regex(@"[0-9][0-9,.]*"); //MatchCollection mc = reg.Matches(total); //foreach (Match m in mc) //{ // bb += m.Value; //} Str.Total = (double.Parse(total.ToString())); Str.Pay_type = "微信支付"; Str.Wid = 44; Str.Str_sm = TextBox1.Text; add.Add_order(Str); // int aa = add.Add_order(Str); //ClientScript.RegisterStartupScript(typeof(string), "操作提示", "<script>alert('" + by_name.Text + bb + text_time .Text+ "')</script>"); // Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('立即支付!');{location.href=''}</script>"); //Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>if(confirm('保存成功!是否?')){location.href='ProductonAdd.aspx'}else{location.href='ProductonList.aspx'}</script>"); Response.Redirect("/api/payment/Hg_pay.aspx?order_dd=" + Str.Order_dd + "&kkl=" + Request.QueryString["number"].ToString() + ""); } else { Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('手速一慢被人捷足先登了!');{location.href='card_sing.aspx'}</script>"); } } }
protected void Page_Load(object sender, EventArgs e) { order_type = Request.QueryString["order_type"]; order_dd = Request.QueryString["Order_dd"]; BLL.HG.Hg_list order_T = new BLL.HG.Hg_list(); if (order_type == "new") { Model.HG.A_HG_new_order model = order_T.getorder(order_dd); string timeStamp = ""; string nonceStr = ""; string paySign = ""; //创建支付应答对象 Senparc.Weixin.MP.TenPayLibV3.RequestHandler packageReqHandler = new Senparc.Weixin.MP.TenPayLibV3.RequestHandler(null); //初始化 packageReqHandler.Init(); litMoney = double.Parse(model.total); timeStamp = TenPayV3Util.GetTimestamp(); nonceStr = TenPayV3Util.GetNoncestr(); //设置package订单参数 packageReqHandler.SetParameter("appid", "wx172ece37e2ed2939"); //公众账号ID packageReqHandler.SetParameter("mch_id", "1403543902"); //商户号 packageReqHandler.SetParameter("nonce_str", nonceStr); //随机字符串 packageReqHandler.SetParameter("body", model.Name_ + "服务"); //商品信息 packageReqHandler.SetParameter("out_trade_no", order_dd); //商家订单号 packageReqHandler.SetParameter("total_fee", ((double.Parse(model.total)) * 100).ToString()); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.SetParameter("spbill_create_ip", Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.SetParameter("notify_url", MyCommFun.getWebSite() + "/api/wxpay/notify_url.aspx?wid=" + 44 + "|" + order_dd); //接收财付通通知的URL packageReqHandler.SetParameter("trade_type", TenPayV3Type.JSAPI.ToString()); //交易类型 packageReqHandler.SetParameter("openid", model.Openid_); //用户的openId string sign = packageReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q"); packageReqHandler.SetParameter("sign", sign); //签名 string data = packageReqHandler.ParseXML(); var result = TenPayV3.Unifiedorder(data); var res = XDocument.Parse(result); string prepayId = res.Element("xml").Element("prepay_id").Value; //设置支付参数 RequestHandler paySignReqHandler = new RequestHandler(null); paySignReqHandler.SetParameter("appId", "wx172ece37e2ed2939"); paySignReqHandler.SetParameter("timeStamp", timeStamp); paySignReqHandler.SetParameter("nonceStr", nonceStr); paySignReqHandler.SetParameter("package", string.Format("prepay_id={0}", prepayId)); paySignReqHandler.SetParameter("signType", "MD5"); paySign = paySignReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q"); payaddid = ""; paytimeStamp = timeStamp; paynonceStr = nonceStr; paypackageValue = string.Format("prepay_id={0}", prepayId); paypaySign = paySign; litDate = DateTime.Now.ToString(); oreder_name = model.Name_ + "服务预约"; } else { hg_number = int.Parse(Request.QueryString["kkl"]); Model.HG.HG_order model = order_T.Getorder(order_dd); string timeStamp = ""; string nonceStr = ""; string paySign = ""; //创建支付应答对象 Senparc.Weixin.MP.TenPayLibV3.RequestHandler packageReqHandler = new Senparc.Weixin.MP.TenPayLibV3.RequestHandler(null); //初始化 packageReqHandler.Init(); litMoney = model.Total; timeStamp = TenPayV3Util.GetTimestamp(); nonceStr = TenPayV3Util.GetNoncestr(); //设置package订单参数 packageReqHandler.SetParameter("appid", "wx172ece37e2ed2939"); //公众账号ID packageReqHandler.SetParameter("mch_id", "1403543902"); //商户号 packageReqHandler.SetParameter("nonce_str", nonceStr); //随机字符串 packageReqHandler.SetParameter("body", model.By_name + "护理"); //商品信息 packageReqHandler.SetParameter("out_trade_no", order_dd); //商家订单号 packageReqHandler.SetParameter("total_fee", ((model.Total) * 100).ToString()); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.SetParameter("spbill_create_ip", Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.SetParameter("notify_url", MyCommFun.getWebSite() + "/api/wxpay/notify_url.aspx?wid=" + 44 + "|" + order_dd); //接收财付通通知的URL packageReqHandler.SetParameter("trade_type", TenPayV3Type.JSAPI.ToString()); //交易类型 packageReqHandler.SetParameter("openid", model.Openid); //用户的openId string sign = packageReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q"); packageReqHandler.SetParameter("sign", sign); //签名 string data = packageReqHandler.ParseXML(); var result = TenPayV3.Unifiedorder(data); var res = XDocument.Parse(result); string prepayId = res.Element("xml").Element("prepay_id").Value; //设置支付参数 RequestHandler paySignReqHandler = new RequestHandler(null); paySignReqHandler.SetParameter("appId", "wx172ece37e2ed2939"); paySignReqHandler.SetParameter("timeStamp", timeStamp); paySignReqHandler.SetParameter("nonceStr", nonceStr); paySignReqHandler.SetParameter("package", string.Format("prepay_id={0}", prepayId)); paySignReqHandler.SetParameter("signType", "MD5"); paySign = paySignReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q"); payaddid = ""; paytimeStamp = timeStamp; paynonceStr = nonceStr; paypackageValue = string.Format("prepay_id={0}", prepayId); paypaySign = paySign; litDate = DateTime.Now.ToString(); oreder_name = model.By_name + "护理预约"; } }
public void ProcessRequest(HttpContext context) { Model.HG.A_HG_new_order Str = new Model.HG.A_HG_new_order(); BLL.HG.Hg_list add = new BLL.HG.Hg_list(); Dictionary <string, string> jsonDict = new Dictionary <string, string>(); jsonDict = new Dictionary <string, string>(); string case_ = context.Request.QueryString["case_"]; if (case_ == "save") { // string openid=context.Request.QueryString["openid"]; string name = context.Request.QueryString["name"]; string phone = context.Request.QueryString["phone"]; string sex = context.Request.QueryString["sex"]; string money = context.Request.QueryString["money"]; string type_ = context.Request.QueryString["type_"]; string time = context.Request.QueryString["time"]; string day = context.Request.QueryString["day"]; string adress = context.Request.QueryString["adress"]; string weixiname = context.Request.QueryString["weixinname"]; string openid = context.Request.QueryString["openid"]; // string total=context.Request.QueryString["total"]; // Str.Openid_ = openid; Str.Name_ = name; Str.Tel_ = phone; Str.Sex_ = sex; Str.Pick_many = money; Str.Type_ = type_; Str.Time_ = time; Str.start_time = DateTime.Now.ToString();//开始时间 Str.Pick_day = day; Str.Weixin_name = weixiname; Str.Openid_ = openid; int day_ = int.Parse(day); int money_ = int.Parse(money); int total_ = day_ * money_; Str.total = total_.ToString(); string bb = DateTime.Now.Day.ToString() + GuidTo16String();//生成的订单号 Str.Order_dd = bb; Str.Order_from = "小程序"; Str.Fw_zt = "未支付"; Str.Delet_ = "未删除"; Str.Adress = adress; int fal = add.Add_order_new(Str); // Str.total = total; if (fal == 0) { jsonDict.Add("order_dd", bb); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", fal.ToString()); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("order_dd", bb); jsonDict.Add("errCode", "true"); jsonDict.Add("recontent", fal.ToString()); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } else if (case_ == "jujia") { { // string openid=context.Request.QueryString["openid"]; string name = context.Request.QueryString["name"]; string phone = context.Request.QueryString["phone"]; string sex = context.Request.QueryString["sex"]; string money = context.Request.QueryString["money"]; string type_ = context.Request.QueryString["type_"]; string time = context.Request.QueryString["time"]; string day = context.Request.QueryString["day"]; string adress = context.Request.QueryString["adress"]; string weixiname = context.Request.QueryString["weixinname"]; string openid = context.Request.QueryString["openid"]; // string total=context.Request.QueryString["total"]; // Str.Openid_ = openid; Str.Name_ = name; Str.Tel_ = phone; Str.Sex_ = sex; Str.Pick_many = money; Str.Type_ = type_; Str.Time_ = time; Str.start_time = DateTime.Now.ToString();//开始时间 Str.Pick_day = day; Str.Weixin_name = weixiname; Str.Openid_ = openid; Str.total = money; string bb = DateTime.Now.Day.ToString() + GuidTo16String();//生成的订单号 Str.Order_dd = bb; Str.Order_from = "小程序"; Str.Fw_zt = "未支付"; Str.Delet_ = "未删除"; Str.Adress = adress; int fal = add.Add_order_new(Str); // Str.total = total; if (fal == 0) { jsonDict.Add("order_dd", bb); jsonDict.Add("errCode", "false"); jsonDict.Add("recontent", fal.ToString()); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } else { jsonDict.Add("order_dd", bb); jsonDict.Add("errCode", "true"); jsonDict.Add("recontent", fal.ToString()); context.Response.Write(MyCommFun.getJsonStr(jsonDict)); } } } else if (case_ == "order") { string openid = context.Request.QueryString["openid"]; context.Response.ContentType = "text/json"; context.Response.Write(MyCommFun.GetJsonByDataset(order_new(openid))); } else { order_dd = MyCommFun.QueryString("order"); BLL.HG.Hg_list order_T = new BLL.HG.Hg_list(); Model.HG.A_HG_new_order model = order_T.getorder(order_dd); string timeStamp = ""; string nonceStr = ""; string paySign = ""; //创建支付应答对象 Senparc.Weixin.MP.TenPayLibV3.RequestHandler packageReqHandler = new Senparc.Weixin.MP.TenPayLibV3.RequestHandler(null); //初始化 packageReqHandler.Init(); timeStamp = TenPayV3Util.GetTimestamp(); nonceStr = TenPayV3Util.GetNoncestr(); //设置package订单参数 packageReqHandler.SetParameter("appid", "wx16650bedd9b0916a"); //公众账号ID packageReqHandler.SetParameter("mch_id", "1403543902"); //商户号 packageReqHandler.SetParameter("nonce_str", nonceStr); //随机字符串 packageReqHandler.SetParameter("body", model.Name_ + "服务"); //商品信息 packageReqHandler.SetParameter("out_trade_no", order_dd); //商家订单号 packageReqHandler.SetParameter("total_fee", ((double.Parse(model.total)) * 100).ToString()); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.SetParameter("spbill_create_ip", context.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.SetParameter("notify_url", MyCommFun.getWebSite() + "/api/wxpay/notify_url.aspx?wid=" + 44 + "|" + order_dd); //接收财付通通知的URL packageReqHandler.SetParameter("trade_type", TenPayV3Type.JSAPI.ToString()); //交易类型 packageReqHandler.SetParameter("openid", model.Openid_); //用户的openId string sign = packageReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q"); packageReqHandler.SetParameter("sign", sign); //签名 string data = packageReqHandler.ParseXML(); var result = TenPayV3.Unifiedorder(data); DateTime bb111 = new DateTime(); WriteTextLog(bb111, result); var res = XDocument.Parse(result); string prepayId = res.Element("xml").Element("prepay_id").Value; //设置支付参数 RequestHandler paySignReqHandler = new RequestHandler(null); paySignReqHandler.SetParameter("appId", "wx16650bedd9b0916a"); paySignReqHandler.SetParameter("timeStamp", timeStamp); paySignReqHandler.SetParameter("nonceStr", nonceStr); paySignReqHandler.SetParameter("package", string.Format("prepay_id={0}", prepayId)); paySignReqHandler.SetParameter("signType", "MD5"); paySign = paySignReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q"); payaddid = ""; paytimeStamp = timeStamp; paynonceStr = nonceStr; paypackageValue = string.Format("prepay_id={0}", prepayId); paypaySign = paySign; litDate = DateTime.Now.ToString(); oreder_name = model.Name_ + "服务预约"; context.Response.ContentType = "text/json"; pay_ bb = new pay_ { timeStamp = timeStamp, nonceStr = nonceStr, paySign = paySign, signType = "MD5", package = prepayId }; string json_bill = JsonMapper.ToJson(bb); context.Response.Write(json_bill); } }