public Order Charge(Order order) { try { decimal totalPrice = (decimal)(order.BuyAmount * 2); decimal totalPriceFixed = totalPrice; int isContinue = 0; while (totalPrice > 0) { #region 提交充值 int chargeVbiNum = 0; if (isContinue > 3) //充值频繁,重试三次 { break; } if (!GetChargeNum((int)totalPrice, ref chargeVbiNum)) { break; } totalPrice = totalPrice - chargeVbiNum; string result = ""; CookieContainer cookie = new CookieContainer(); #region 帐号登录 result = PostAndGet.HttpGetString("http://pay.hongxiu.com/model/GetUserBaseInfo.aspx?roundmun=0.8916430823085395", "", ref cookie); if (string.IsNullOrEmpty(result)) { if (!login(order, ref cookie)) { totalPrice += chargeVbiNum; order.RechargeMsg = "帐号登录失败"; continue; } } #endregion #region 获取参数 订单确认 result = PostAndGet.HttpGetString("http://pay.hongxiu.com/model/GetUserBaseInfo.aspx?roundmun=0.8916430823085395", "", ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",获取登录信息:" + result, LogPathFile.Recharge); string [] arrLoginAccount = result.Split('|'); if (arrLoginAccount.Length < 2) { break; } string txtUserid = arrLoginAccount[0]; string txtusername = arrLoginAccount[1]; result = PostAndGet.HttpGetString_HX("http://hxzz.hxcdn.net/?d=pay.hongxiu.com&hxid=" + txtUserid + "&f=/default.shtml&q=&aid=0&bid=0", "", ref cookie, "hxzz.hxcdn.net", "http://pay.hongxiu.com/default.shtml"); result = PostAndGet.HttpGetString_HX("http://pay.hongxiu.com/charge/guhua.shtml", "", ref cookie, "pay.hongxiu.com"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",充值页面提交返回:" + result, LogPathFile.Recharge); StringBuilder payTypeDataBuilder = new StringBuilder(); payTypeDataBuilder.AppendFormat("usertype={0}", "1"); payTypeDataBuilder.AppendFormat("&txtotherusername={0}", System.Web.HttpUtility.UrlEncode(order.TargetAccount, Encoding.UTF8)); payTypeDataBuilder.AppendFormat("&txtreotherusername={0}", System.Web.HttpUtility.UrlEncode(order.TargetAccount, Encoding.UTF8)); payTypeDataBuilder.AppendFormat("&txtuserid={0}", txtUserid); payTypeDataBuilder.AppendFormat("&txtusername={0}", txtusername); result = PostAndGet.HttpPostString_HX("http://pay.hongxiu.com/charge/cp.aspx?paytype=votev2", payTypeDataBuilder.ToString(), ref cookie, "pay.hongxiu.com"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第一步提交返回:" + result, LogPathFile.Recharge); if (result.Contains("此用户不存在")) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "此用户不存在"; return(order); } result = PostAndGet.HttpGetString("http://pay.hongxiu.com/charge/TelChargeV2.aspx", "", ref cookie, "http://pay.hongxiu.com/charge/cp.aspx?paytype=votev2"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第二步提交返回:" + result, LogPathFile.Recharge); string __VIEWSTATE = Regex.Match(result, @"id=""__VIEWSTATE"" value=""(.*?)""\s+/>").Groups [1].Value; string __EVENTVALIDATION = Regex.Match(result, @"id=""__EVENTVALIDATION"" value=""(.*?)""\s+/>").Groups[1].Value; StringBuilder chargeV2DataBuilder = new StringBuilder(); payTypeDataBuilder.AppendFormat("__VIEWSTATE={0}", __VIEWSTATE); payTypeDataBuilder.AppendFormat("&__EVENTVALIDATION={0}", __EVENTVALIDATION); payTypeDataBuilder.AppendFormat("&userid={0}", order.TargetAccount); payTypeDataBuilder.AppendFormat("&btnSubmit={0}", "=%E6%8F%90++%E4%BA%A4"); payTypeDataBuilder.AppendFormat("&txtusername={0}", chargeVbiNum); result = PostAndGet.HttpGetString("http://pay.hongxiu.com/charge/TelChargeV2.aspx", chargeV2DataBuilder.ToString(), ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第二步确认提交返回:" + result, LogPathFile.Recharge); result = PostAndGet.HttpGetString("http://pay.hongxiu.com/charge/ChargeStep3.aspx", "", ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第三步提交返回:" + result, LogPathFile.Recharge); //if (!result.Contains("充值确认")) //{ // totalPrice += chargeVbiNum; // continue; //} #endregion #region Vbi钱包充值 string spid = Regex.Match(result, @"name='spid'\s+value='(.*?)'>").Groups[1].Value; string spname = Regex.Match(result, @"name='spname'\s+value='(.*?)'>").Groups[1].Value; string spoid = Regex.Match(result, @"name='spoid'\s+value='(.*?)'>").Groups[1].Value; string spreq = Regex.Match(result, @"name='spreq'\s+value='(.*?)'>").Groups[1].Value; string sprec = Regex.Match(result, @"name='sprec'\s+value='(.*?)'>").Groups[1].Value; string userid = Regex.Match(result, @"name='userid'\s+value='(.*?)'>").Groups[1].Value; string userip = Regex.Match(result, @"name='userip'\s+value='(.*?)'>").Groups[1].Value; string spmd5 = Regex.Match(result, @"name='spmd5'\s+value='(.*?)'>").Groups[1].Value; string spcustom = Regex.Match(result, @"name='spcustom'\s+value='(.*?)'>").Groups[1].Value; string spversion = Regex.Match(result, @"name='spversion'\s+value='(.*?)'>").Groups[1].Value; string money = Regex.Match(result, @"name='money'\s+value='(.*?)'>").Groups[1].Value; string urlcode = Regex.Match(result, @"name='urlcode'\s+value='(.*?)'>").Groups[1].Value; StringBuilder vnetonePostdataBuilder = new StringBuilder(); vnetonePostdataBuilder.AppendFormat("spid={0}", spid); vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid); vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&userid={0}", userid); vnetonePostdataBuilder.AppendFormat("&userip={0}", userip); vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5); vnetonePostdataBuilder.AppendFormat("&spcustom={0}", System.Web.HttpUtility.UrlEncode(spcustom, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion); vnetonePostdataBuilder.AppendFormat("&money={0}", money); vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode); OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi); if (orderChargeAccount == null) { order.RechargeMsg += "未取到v币帐号||"; totalPrice++; isContinue++; continue; } result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie); #endregion #region 充值结果判断 if (result.Contains("成功") || result.Contains("您已成功充值")) { order.RechargeMsg += "充值成功||"; order.SuccessfulAmount += chargeVbiNum; orderChargeAccount.Balance = orderChargeAccount.Balance - chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } else if (result.Contains("请五分钟后再登陆商户网站进行帐户查询")) { order.RechargeMsg += "充值成功(请五分钟后再登陆商户网站进行帐户查询)||"; order.SuccessfulAmount += chargeVbiNum; orderChargeAccount.Balance = orderChargeAccount.Balance - chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } else if (result.Contains("操作失败")) { order.RechargeMsg += "操作失败||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("充值过于频繁")) { order.RechargeMsg += "充值频繁||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("验证码输入不正确")) { order.RechargeMsg += "验证码输入不正确||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("账户余额不足")) { order.RechargeMsg += "账户余额不足||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); } else if (result.Contains("支付密码不正确")) { order.RechargeMsg += "支付密码不正确||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); } else if (result.Contains("用户不存在")) { order.RechargeMsg += "用户不存在||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); } else { order.RechargeMsg += "存疑||"; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } #endregion #endregion } #region 订单状态判断 if (order.SuccessfulAmount >= totalPriceFixed) { order.RechargeStatus = (int)OrderRechargeStatus.successful; } else { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; } #endregion return(order); } catch (Exception ex) { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",充值一场信息:" + ex.Message, LogPathFile.Exception); return(order); } }
public Order Charge(Order order) { try { CookieContainer cookie = new CookieContainer(); decimal totalAmount = (decimal)order.BuyAmount; decimal totalAmountNum = totalAmount; int isContinue = 0; if (CheckStrHelper.IsChinese(order.TargetAccount)) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "用户名不合法"; return(order); } order.TargetAccount = CheckChargeAccount(order.TargetAccount); string radPayType = "1"; if (order.RechargeModeName.Contains("帐号直充") || order.RechargeModeName.Contains("通用点") || order.RechargeModeName.Contains("游戏点数") || order.RechargeModeName.Contains("帐号充值")) { radPayType = "1"; } else if (order.RechargeModeName.Contains("寄售点") || order.RechargeModeName.Contains("点数寄售") || order.RechargeModeName.Contains("点卡交易/寄售")) { radPayType = "2"; } while (totalAmount > 0) { #region 提交充值 int chargeNum = 0; int vibiNum = 0; if (isContinue > 3) //充值频繁,重试三次 { break; } if (!GetChargeNum((int)totalAmount, ref chargeNum)) { break; } totalAmount = totalAmount - chargeNum; vibiNum = chargeNum * 2; string result = ""; #region 获取参数 帐号判断 result = PostAndGet.HttpGetString("http://www.vpay8.com/Fetch/wy/wpay.aspx", "", ref cookie); string __VIEWSTATE = Regex.Match(result, @"id=""__VIEWSTATE""\s+value=""(.*?)"" />").Groups[1].Value; string __EVENTVALIDATION = Regex.Match(result, @"id=""__EVENTVALIDATION""\s+value=""(.*?)"" />").Groups[1].Value; StringBuilder checkgetDataBuilder = new StringBuilder(); checkgetDataBuilder.AppendFormat("__VIEWSTATE={0}", System.Web.HttpUtility.UrlEncode(__VIEWSTATE)); checkgetDataBuilder.AppendFormat("&__EVENTVALIDATION={0}", System.Web.HttpUtility.UrlEncode(__EVENTVALIDATION)); checkgetDataBuilder.AppendFormat("&DropDownList1={0}", chargeNum * 10); checkgetDataBuilder.AppendFormat("&radPayType={0}", radPayType); checkgetDataBuilder.AppendFormat("&qqnum={0}", order.TargetAccount); checkgetDataBuilder.AppendFormat("&qqnum2={0}", order.TargetAccount); checkgetDataBuilder.AppendFormat("&Button2={0}", "%E6%8F%90%E4%BA%A4%E8%AE%A2%E5%8D%95"); result = PostAndGet.HttpPostString("http://www.vpay8.com/Fetch/wy/wpay.aspx", checkgetDataBuilder.ToString(), ref cookie, "http://www.vpay8.com/Fetch/wy/wpay.aspx"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "提交参数:" + checkgetDataBuilder.ToString() + ",订单第一步提交返回:" + result, LogPathFile.Recharge); if (result.Contains("请输入正确的网易通行证账号")) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "帐号不存在"; return(order); } //string href = Regex.Match(result, @"<a href=""(.*?)"">").Groups[1].Value; ////http://www.vpay8.com/Fetch/wy/WSubmit.aspx?orderid=WY170313223559213118&pv=1&v=30&[email protected]&s=1788a04956cd27cc45de0d83f9ef010c //result = PostAndGet.HttpGetString(System.Web.HttpUtility.UrlDecode(href, Encoding.Default), checkgetDataBuilder.ToString(), ref cookie); //WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount // + ",订单第二步提交返回:" + result, LogPathFile.Recharge); #endregion #region Vbi钱包充值 string spid = Regex.Match(result, @"<input name='spid'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string spname = Regex.Match(result, @"<input name='spname'\s+type=""hidden""\s+value='(.*?)'> ").Groups[1].Value; string spoid = Regex.Match(result, @"<input name='spoid'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string spreq = Regex.Match(result, @"<input name='spreq'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string sprec = Regex.Match(result, @"<input name='sprec'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string userid = Regex.Match(result, @"<input name='userid'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string userip = Regex.Match(result, @"<input name='userip'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string spmd5 = Regex.Match(result, @"<input name='spmd5'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string spcustom = Regex.Match(result, @"<input name='spcustom'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string spversion = Regex.Match(result, @"<input name='spversion'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string urlcode = Regex.Match(result, @"<input name='urlcode'\s+type=hidden\s+value='(.*?)' >").Groups[1].Value; string spzf = Regex.Match(result, @"<input name='spzf'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; string money = Regex.Match(result, @"<input name='money'\s+type=""hidden""\s+value='(.*?)' >").Groups[1].Value; StringBuilder vnetonePostdataBuilder = new StringBuilder(); vnetonePostdataBuilder.AppendFormat("spid={0}", spid); vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid); vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&userid={0}", System.Web.HttpUtility.UrlEncode(userid, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&userip={0}", userip); vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5); vnetonePostdataBuilder.AppendFormat("&spcustom={0}", System.Web.HttpUtility.UrlEncode(spcustom, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion); vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode); vnetonePostdataBuilder.AppendFormat("&spzf={0}", spzf); vnetonePostdataBuilder.AppendFormat("&money={0}", money); OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi); if (orderChargeAccount == null) { order.RechargeMsg += "未取到v币帐号||"; isContinue++; continue; } result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie, vibiNum); #endregion #region 充值结果判断 if (result.Contains("成功") || result.Contains("您已成功充值") || result.Contains("成功充值")) { order.RechargeMsg += spoid + "充值成功||"; order.SuccessfulAmount += chargeNum; orderChargeAccount.Balance = orderChargeAccount.Balance - chargeNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } else if (result.Contains("请五分钟后再登陆商户网站进行帐户查询")) { order.RechargeMsg += spoid + "充值成功(请五分钟后再登陆商户网站进行帐户查询)||"; order.SuccessfulAmount += chargeNum; orderChargeAccount.Balance = orderChargeAccount.Balance - chargeNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } else if (result.Contains("操作失败")) { order.RechargeMsg += spoid + "操作失败||"; totalAmount += chargeNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("充值过于频繁")) { order.RechargeMsg += "充值频繁||"; totalAmount += chargeNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("验证码输入不正确")) { order.RechargeMsg += spoid + "验证码输入不正确||"; totalAmount += chargeNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("账户余额不足")) { order.RechargeMsg += "账户余额不足||"; totalAmount += chargeNum;; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); isContinue++; } else if (result.Contains("支付密码不正确")) { order.RechargeMsg += spoid + "支付密码不正确||"; totalAmount += chargeNum;; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); isContinue++; } else if (result.Contains("用户不存在")) { order.RechargeMsg += spoid + "用户不存在||"; totalAmount += chargeNum;; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); isContinue++; } else if (result.Contains("操作_Failure")) { order.RechargeMsg += spoid + "帐号错误||"; totalAmount += chargeNum;; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else { order.RechargeMsg += spoid + "存疑||"; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } #endregion #endregion } #region 订单状态判断 if (order.SuccessfulAmount >= totalAmountNum) { order.RechargeStatus = (int)OrderRechargeStatus.successful; } else if (order.SuccessfulAmount <= 0) { if (order.RechargeMsg.Contains("帐号错误") || order.RechargeMsg.Contains("用户不存在")) { order.RechargeStatus = (int)OrderRechargeStatus.failure; } else { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; } } else { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; } #endregion return(order); } catch (Exception ex) { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",充值异常信息:" + ex.Message, LogPathFile.Exception); return(order); } }
public Order Charge(Order order) { try { decimal totalPrice = (decimal)order.BuyAmount; decimal totalPriceFixed = totalPrice; int isContinue = 0; string payment = ""; if (!Getpayment((int)order.ProductParValue, ref payment)) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "充值面值不合法"; return(order); } if (CheckStrHelper.IsChinese(order.TargetAccount)) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "充值帐号不能为中文"; return(order); } if (order.TargetAccount.Length < 6 || order.TargetAccount.Length > 20) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "请输入6~20位字母和数字"; return(order); } CookieContainer cookie = new CookieContainer(); while (totalPrice > 0) { #region 提交充值 if (isContinue > 3) //充值频繁,重试三次 { break; } totalPrice--;; #region 帐号登录 string result = PostAndGet.HttpGetString_XY("http://my.xunyou.com/index.php/uCenter/getLoginId", "", ref cookie); if (result.Contains("-1")) { if (!login(order, ref cookie)) { order.RechargeMsg = "帐号登录失败"; totalPrice++; isContinue++; continue; } } #endregion #region 获取参数 订单确认 string postURl = "https://my.xunyou.com/index.php/payment/confirmPayment2014"; StringBuilder postData = new StringBuilder(); postData.AppendFormat("payment_object={0}", System.Web.HttpUtility.UrlEncode(payment, Encoding.Default)); postData.AppendFormat("&isconversion={0}", "2"); postData.AppendFormat("&product_id={0}", "2"); postData.AppendFormat("&payment_login={0}", order.TargetAccount); postData.AppendFormat("&usernameinput={0}", order.TargetAccount); postData.AppendFormat("&payment_login_confirm={0}", order.TargetAccount); postData.AppendFormat("&payment_card={0}", "ICBC-NET"); postData.AppendFormat("&selected_product_name={0}", "%E8%BF%85%E6%B8%B8VIP"); postData.AppendFormat("&user_mask1={0}", ""); postData.AppendFormat("&user_mask2={0}", ""); postData.AppendFormat("&addition_product_id={0}", ""); postData.AppendFormat("&userid={0}", ""); postData.AppendFormat("&sub_product_class={0}", ""); postData.AppendFormat("&client={0}", " 0"); postData.AppendFormat("&payment_method={0}", "28"); postData.AppendFormat("&eid={0}", "10612"); postData.AppendFormat("&gameid={0}", "0"); postData.AppendFormat("&gid={0}", "0"); postData.AppendFormat("&cdkey={0}", "0"); postData.AppendFormat("&payment_card_account={0}", ""); postData.AppendFormat("&payment_card_password={0}", ""); postData.AppendFormat("&payment_bank={0}", "8001"); postData.AppendFormat("&vertifycode={0}", ""); postData.AppendFormat("&mobile_num={0}", ""); postData.AppendFormat("&packid={0}", "0"); postData.AppendFormat("&mac={0}", ""); postData.AppendFormat("&pageid={0}", "4"); postData.AppendFormat("&pwd={0}", ""); postData.AppendFormat("&spid={0}", ""); postData.AppendFormat("&spid2={0}", ""); result = PostAndGet.HttpPostString(postURl, postData.ToString(), ref cookie, "https://my.xunyou.com/pay/?eid=10612"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第一步提交返回:" + result, LogPathFile.Recharge); if (result.Contains("用户不存在")) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "用户不存在"; return(order); } if (result.Contains("请更换其他支付方式")) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "帐号未设置安全工具"; return(order); } if (!result.Contains("确认订单")) { totalPrice++; isContinue++; continue; } #endregion #region Vbi钱包充值 string spid = Regex.Match(result, @"value=""(.*?)"" name=""spid""").Groups[1].Value; string spname = Regex.Match(result, @"value=""(.*?)"" name=""spname""").Groups[1].Value; string spoid = Regex.Match(result, @"value=""(.*?)"" name=""spoid""").Groups[1].Value; string spreq = Regex.Match(result, @"value=""(.*?)"" name=""spreq""").Groups[1].Value; string sprec = Regex.Match(result, @"value=""(.*?)"" name=""sprec""").Groups[1].Value; string userip = Regex.Match(result, @"value=""(.*?)"" name=""userip""").Groups[1].Value; string spcustom = Regex.Match(result, @"value=""(.*?)"" name=""spcustom""").Groups[1].Value; string spversion = Regex.Match(result, @"value=""(.*?)"" name=""spversion""").Groups[1].Value; string money = Regex.Match(result, @"value=""(.*?)"" name=""money""").Groups[1].Value; string urlcode = Regex.Match(result, @"value=""(.*?)"" name=""urlcode""").Groups[1].Value; string spmd5 = Regex.Match(result, @"value=""(.*?)"" name=""spmd5""").Groups[1].Value; string userid = Regex.Match(result, @"value=""(.*?)"" name=""userid""").Groups[1].Value; string payment_object = Regex.Match(result, @"value=""(.*?)"" name=""payment_object""").Groups[1].Value; string payment_orderid = Regex.Match(result, @"value=""(.*?)"" name=""payment_orderid""").Groups[1].Value; string payment_login = Regex.Match(result, @"value=""(.*?)"" name=""payment_login""").Groups[1].Value; string payment_product = Regex.Match(result, @"value=""(.*?)"" name=""payment_product""").Groups[1].Value; string payment_paymoney = Regex.Match(result, @"value=""(.*?)"" name=""payment_paymoney""").Groups[1].Value; StringBuilder vnetonePostdataBuilder = new StringBuilder(); vnetonePostdataBuilder.AppendFormat("spid={0}", spid); vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid); vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&userip={0}", userip); vnetonePostdataBuilder.AppendFormat("&spcustom={0}", spcustom); vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion); vnetonePostdataBuilder.AppendFormat("&money={0}", money); vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode); vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5); vnetonePostdataBuilder.AppendFormat("&userid={0}", userid); vnetonePostdataBuilder.AppendFormat("&payment_object={0}", System.Web.HttpUtility.UrlEncode(payment_object, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&payment_orderid={0}", payment_orderid); vnetonePostdataBuilder.AppendFormat("&payment_login={0}", payment_login); vnetonePostdataBuilder.AppendFormat("&payment_product={0}", System.Web.HttpUtility.UrlEncode(payment_product, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&payment_paymoney={0}", System.Web.HttpUtility.UrlEncode(payment_paymoney, Encoding.Default)); OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi); if (orderChargeAccount == null) { order.RechargeMsg += "未取到v币帐号||"; totalPrice++; isContinue++; continue; } result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",V币钱包充值返回:" + result, LogPathFile.Recharge); #endregion #region 迅游订单查询 result = PostAndGet.HttpGetString_XY("https://my.xunyou.com/index.php/payment/getOrderState/" + spoid, "", ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单查询结果:" + result, LogPathFile.Recharge); string xyOrderStatus = Regex.Match(result, @"{""state"":(.*?),").Groups[1].Value; string xyfpaysuccess = Regex.Match(result, @"""fpaysuccess"":""(.*?)"",").Groups[1].Value; if (xyOrderStatus == "1") { if (xyfpaysuccess == "1") { order.RechargeMsg += spoid + "充值成功||"; order.SuccessfulAmount += order.ProductParValue; orderChargeAccount.Balance = orderChargeAccount.Balance - order.ProductParValue; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } else if (xyfpaysuccess == "0") { order.RechargeMsg += spoid + "未支付成功||"; totalPrice++; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue = isContinue + 6; } else { order.RechargeMsg += spoid + "存疑||"; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } } else { order.RechargeMsg += spoid + "存疑||"; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } #endregion #region VB充值结果判断 //if (result.Contains("成功") || result.Contains("您已成功充值") || result.Contains("成功充值")) //{ // order.RechargeMsg += "充值成功||"; // order.SuccessfulAmount += order.ProductParValue; // orderChargeAccount.Balance = orderChargeAccount.Balance - order.ProductParValue; // SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); //} //else if (result.Contains("请五分钟后再登陆商户网站进行帐户查询")) //{ // order.RechargeMsg += "充值成功(请五分钟后再登陆商户网站进行帐户查询)||"; // order.SuccessfulAmount += order.ProductParValue; // orderChargeAccount.Balance = orderChargeAccount.Balance - order.ProductParValue; // SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); //} //else if (result.Contains("操作失败")) //{ // order.RechargeMsg += "操作失败||"; // totalPrice++; // SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); // isContinue++; //} //else if (result.Contains("充值过于频繁")) //{ // order.RechargeMsg += "充值频繁||"; // totalPrice++; // SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); // isContinue++; //} //else if (result.Contains("验证码输入不正确")) //{ // order.RechargeMsg += "验证码输入不正确||"; // totalPrice++; // SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); // isContinue++; //} //else if (result.Contains("账户余额不足")) //{ // order.RechargeMsg += "账户余额不足||"; // totalPrice++; // SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); //} //else if (result.Contains("支付密码不正确")) //{ // order.RechargeMsg += "支付密码不正确||"; // totalPrice++; // SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); //} //else if (result.Contains("用户不存在")) //{ // order.RechargeMsg += "用户不存在||"; // totalPrice++; // SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); //} //else //{ // order.RechargeMsg += "存疑||"; // SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); //} #endregion #endregion } #region 订单状态判断 if (order.SuccessfulAmount >= totalPriceFixed) { order.RechargeStatus = (int)OrderRechargeStatus.successful; } else { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; } #endregion return(order); } catch (Exception ex) { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",充值一场信息:" + ex.Message, LogPathFile.Exception); return(order); } }
public Order Charge(Order order) { try { CookieContainer cc = new CookieContainer(); string sd = PostAndGet.HttpGetString_91y("http://member.91y.com/login/login.aspx?t=0.15243408223597132", "", ref cc); ChargeInterface.ChargeHelper.SlideVerification.SlideVerification.VerificationFor91y(cc); decimal totalPrice = (decimal)order.BuyAmount; decimal totalPriceFixed = totalPrice; int isContinue = 0; int pay_amount_Value = 0; if (order.ProductParValue == 3) { pay_amount_Value = 5; } else if (order.ProductParValue == 30) { pay_amount_Value = 50; } else { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "充值数量错误"; return(order); } CookieContainer cookie = new CookieContainer(); string checkAccount = PostAndGet.HttpGetString_91y("https://pay.91y.com/servlet/do.ashx?a=changeuser&acc=" + order.TargetAccount + "&t=0.48772043911252916", "", ref cookie, "pay.91y.com", "https://pay.91y.com/phonecard/"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",帐号检测提交返回:" + checkAccount, LogPathFile.Recharge); //[{Accounts: 'c8ac1023fdf01aef080dac852f72fb1b',Nickname: '%e4%b8%9c%e6%96%b9%e8%88%9e%e6%94%92',GameID: '226124557'}] string Accounts = Regex.Match(checkAccount, @"Accounts: '(.*?)'").Groups[1].Value; string Nickname = Regex.Match(checkAccount, @"Nickname: '(.*?)'").Groups[1].Value; string GameID = Regex.Match(checkAccount, @"GameID: '(.*?)'").Groups[1].Value; if (Accounts.Equals("0")) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "帐号错误"; return(order); } while (totalPrice > 0) { #region 提交充值 if (isContinue > 3) //充值频繁,重试三次 { break; } totalPrice--; #region 参数提交 string tradeverifyUrl = "https://pay.91y.com/tradeverify/"; StringBuilder tradeverifyStr = new StringBuilder(); tradeverifyStr.AppendFormat("user_qq={0}", ""); tradeverifyStr.AppendFormat("&pay_User={0}", Accounts); tradeverifyStr.AppendFormat("&pd_FrpId={0}", "TEL-NET"); tradeverifyStr.AppendFormat("&pay_amount={0}", pay_amount_Value); tradeverifyStr.AppendFormat("&pay_type={0}", "4"); tradeverifyStr.AppendFormat("&step={0}", "2"); string result = PostAndGet.HttpPostString_91y(tradeverifyUrl, tradeverifyStr.ToString(), ref cookie, null, "https://pay.91y.com/tel/"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第一步提交返回:" + result, LogPathFile.Recharge); if (result.Contains("无法继续充值")) { order.RechargeMsg += "充值已达每日上限"; totalPrice++; break; } if (result.Contains("请使用其他方式充值")) { order.RechargeMsg += "短信充值不能超过50,请使用其他方式充值"; totalPrice++; break; } #endregion #region 确认提交 string pay_amount = Regex.Match(result, @"id=""pay_amount""\s+name=""pay_amount""\s+value=""(.*?)""").Groups[1].Value; string pay_BankId = Regex.Match(result, @"id=""pay_BankId""\s+name=""pay_BankId""\s+value=""(.*?)""").Groups[1].Value; string pay_ItemUser = Regex.Match(result, @"id=""pay_User""\s+name=""pay_ItemUser""\s+value=""(.*?)""").Groups[1].Value; string pay_UserID = Regex.Match(result, @"id=""pay_UserID""\s+name=""pay_UserID""\s+value=""(.*?)""").Groups[1].Value; string pay_OrderId = Regex.Match(result, @"id=""pay_OrderId""\s+name=""pay_OrderId""\s+value=""(.*?)""").Groups[1].Value; string pay_ItemName = Regex.Match(result, @"id=""pay_ItemName""\s+name=""pay_ItemName""\s+value=""(.*?)""").Groups[1].Value; string pay_Type = Regex.Match(result, @"id=""pay_Type""\s+name=""pay_Type""\s+value=""(.*?)""").Groups[1].Value; string step = Regex.Match(result, @"id=""pay_step""\s+name=""step""\s+value=""(.*?)""").Groups[1].Value; string servletUrl = "https://pay.91y.com/servlet/PayRequest.aspx"; StringBuilder servletStr = new StringBuilder(); servletStr.AppendFormat("pay_amount={0}", pay_amount); servletStr.AppendFormat("&pay_BankId={0}", pay_BankId); servletStr.AppendFormat("&pay_ItemUser={0}", pay_ItemUser); servletStr.AppendFormat("&pay_UserID={0}", pay_UserID); servletStr.AppendFormat("&pay_OrderId={0}", pay_OrderId); servletStr.AppendFormat("&pay_ItemName={0}", pay_ItemName); servletStr.AppendFormat("&pay_Type={0}", pay_Type); servletStr.AppendFormat("&step={0}", step); result = PostAndGet.HttpPostString_91y(servletUrl, servletStr.ToString(), ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第二步提交返回:" + result, LogPathFile.Recharge); if (!result.Contains("订单提交")) { totalPrice++; continue; } #endregion #region Vbi钱包充值 string spid = Regex.Match(result, @"name='spid'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string spname = Regex.Match(result, @"name='spname'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string spoid = Regex.Match(result, @"name='spoid'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string spreq = Regex.Match(result, @"name='spreq'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string sprec = Regex.Match(result, @"name='sprec'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string userid = Regex.Match(result, @"name='userid'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string userip = Regex.Match(result, @"name='userip'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string spmd5 = Regex.Match(result, @"name='spmd5'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string spcustom = Regex.Match(result, @"name='spcustom'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string spversion = Regex.Match(result, @"name='spversion'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string money = Regex.Match(result, @"name='money'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; string urlcode = Regex.Match(result, @"name='urlcode'\s+type=hidden\s+value='(.*?)'").Groups[1].Value; StringBuilder vnetonePostdataBuilder = new StringBuilder(); vnetonePostdataBuilder.AppendFormat("spid={0}", spid); vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid); vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&userid={0}", userid); vnetonePostdataBuilder.AppendFormat("&userip={0}", userip); vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5); vnetonePostdataBuilder.AppendFormat("&spcustom={0}", System.Web.HttpUtility.UrlEncode(spcustom, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion); vnetonePostdataBuilder.AppendFormat("&money={0}", money); vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode); OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi); if (orderChargeAccount == null) { order.RechargeMsg += "未取到v币帐号||"; totalPrice++; isContinue++; continue; } result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie); #endregion #region 充值结果判断 if (result.Contains("成功") || result.Contains("您已成功充值")) { order.RechargeMsg += "充值成功||"; order.SuccessfulAmount++; orderChargeAccount.Balance = orderChargeAccount.Balance - pay_amount_Value; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } else if (result.Contains("请五分钟后再登陆商户网站进行帐户查询")) { order.RechargeMsg += "充值成功(请五分钟后再登陆商户网站进行帐户查询)||"; order.SuccessfulAmount++; orderChargeAccount.Balance = orderChargeAccount.Balance - pay_amount_Value; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } else if (result.Contains("操作失败")) { order.RechargeMsg += "操作失败||"; totalPrice++; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("充值过于频繁")) { order.RechargeMsg += "充值频繁||"; totalPrice++; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("验证码输入不正确")) { order.RechargeMsg += "验证码输入不正确||"; totalPrice++; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("账户余额不足")) { order.RechargeMsg += "账户余额不足||"; totalPrice++; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); } else if (result.Contains("支付密码不正确")) { order.RechargeMsg += "支付密码不正确||"; totalPrice++; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); } else if (result.Contains("用户不存在")) { order.RechargeMsg += "用户不存在||"; totalPrice++; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); } else { order.RechargeMsg += "存疑||"; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } #endregion #endregion } #region 订单状态判断 if (order.SuccessfulAmount >= totalPriceFixed) { order.RechargeStatus = (int)OrderRechargeStatus.successful; } else if (order.SuccessfulAmount == 0 && order.RechargeMsg.Contains("充值已达每日上限")) { order.RechargeStatus = (int)OrderRechargeStatus.failure; } else { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; } #endregion return(order); } catch (Exception ex) { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",充值异常信息:" + ex.Message, LogPathFile.Exception); return(order); } }
public Order Charge(Order order) { try { CookieContainer cookie = new CookieContainer(); decimal totalPrice = (decimal)(order.BuyAmount * 2); decimal totalPriceFixed = totalPrice; int isContinue = 0; if (order.BuyAmount % 5 != 0) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "购买数量不合法,请提交5的倍数"; return(order); } while (totalPrice > 0) { #region 提交充值 int chargeVbiNum = 0; if (isContinue > 3) //充值频繁,重试三次 { break; } if (!GetChargeNum((int)totalPrice, ref chargeVbiNum)) { break; } totalPrice = totalPrice - chargeVbiNum; string result = ""; #region 获取参数 帐号判断 result = PostAndGet.HttpGetString("http://pay.37.com/", "", ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",充值页面提交返回:" + result, LogPathFile.Recharge); string f_token = Regex.Match(result, @"name=\""f_token\"" id=\""confirm_f_token\"" value=\""(.*?)\""\>").Groups[1].Value; string g_f_token = Regex.Match(result, @"g_f_token : '(.*?)',").Groups[1].Value; StringBuilder checkgetDataBuilder = new StringBuilder(); checkgetDataBuilder.AppendFormat("action={0}", "check_user"); checkgetDataBuilder.AppendFormat("&user_name={0}", order.TargetAccount); result = PostAndGet.HttpGetString("http://pay.37.com/controller/user.php", checkgetDataBuilder.ToString(), ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第一步提交返回:" + result, LogPathFile.Recharge); string msg = Regex.Match(result, @"""msg"":""(.*?)""}").Groups[1].Value; string str = ""; TypeCast.GetString(msg, ref str); if (str.Contains("请求异常")) { //order.RechargeStatus = (int)OrderRechargeStatus.failure; //order.RechargeMsg = "帐号不存在"; //return order; order.RechargeMsg += "帐号不存在||"; totalPrice++; break; } #endregion #region 确认提交 StringBuilder orderPostdataBuilder = new StringBuilder(); orderPostdataBuilder.AppendFormat("user_name={0}", order.TargetAccount); orderPostdataBuilder.AppendFormat("&game_id={0}", "100000"); orderPostdataBuilder.AppendFormat("&server_id={0}", "100000");; orderPostdataBuilder.AppendFormat("&money={0}", chargeVbiNum); orderPostdataBuilder.AppendFormat("&pay_type={0}", "17"); orderPostdataBuilder.AppendFormat("&pay_for={0}", "platform"); orderPostdataBuilder.AppendFormat("&f_token={0}", g_f_token); orderPostdataBuilder.AppendFormat("&phone={0}", ""); orderPostdataBuilder.AppendFormat("&actor={0}", ""); orderPostdataBuilder.AppendFormat("&pay_bank={0}", ""); orderPostdataBuilder.AppendFormat("&envelope_id={0}", ""); orderPostdataBuilder.AppendFormat("&safe_code={0}", ""); orderPostdataBuilder.AppendFormat("&pay_referer={0}", ""); orderPostdataBuilder.AppendFormat("&action={0}", "create_order"); orderPostdataBuilder.AppendFormat("&ajax={0}", "0"); result = PostAndGet.HttpPostString("http://pay.37.com/controller/order_v2.php", orderPostdataBuilder.ToString(), ref cookie); string order_id = Regex.Match(result, @"order_id=(.*?)&").Groups[1].Value; WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第二步提交返回:" + result, LogPathFile.Recharge); StringBuilder payPostdataBuilder = new StringBuilder(); payPostdataBuilder.AppendFormat("action={0}", "go_pay"); payPostdataBuilder.AppendFormat("&order_id={0}", order_id); payPostdataBuilder.AppendFormat("&f_token={0}", f_token); payPostdataBuilder.AppendFormat("&p_code={0}", ""); payPostdataBuilder.AppendFormat("&th_cardno={0}", ""); payPostdataBuilder.AppendFormat("&th_cardpwd={0}", ""); result = PostAndGet.HttpPostString("http://pay.37.com/controller/paygate.php", payPostdataBuilder.ToString(), ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第三步提交返回:" + result, LogPathFile.Recharge); if (!result.Contains("正在跳转")) { totalPrice += chargeVbiNum; isContinue++; continue; } #endregion #region Vbi钱包充值 string spid = Regex.Match(result, @"<input name='spid'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value; string spname = Regex.Match(result, @"<input name='spname'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value; string spoid = Regex.Match(result, @"<input name='spoid'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value; string spreq = Regex.Match(result, @"<input name='spreq'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value; string sprec = Regex.Match(result, @"<input name='sprec'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value; string userid = Regex.Match(result, @"<input name='userid'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value; string userip = Regex.Match(result, @"<input name='userip'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value; string spmd5 = Regex.Match(result, @"<input name='spmd5'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value; string spcustom = Regex.Match(result, @"<input name='spcustom'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value; string spversion = Regex.Match(result, @"<input name='spversion'\s+type=hidden\s+value=""(.*?)""").Groups[1].Value; string money = Regex.Match(result, @"<input name='money'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value; string urlcode = Regex.Match(result, @"<input name='urlcode'\s+type=hidden\s+value=""(.*?)""\s+>").Groups[1].Value; StringBuilder vnetonePostdataBuilder = new StringBuilder(); vnetonePostdataBuilder.AppendFormat("spid={0}", spid); vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid); vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&userid={0}", userid); vnetonePostdataBuilder.AppendFormat("&userip={0}", userip); vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5); vnetonePostdataBuilder.AppendFormat("&spcustom={0}", System.Web.HttpUtility.UrlEncode(spcustom, Encoding.UTF8)); vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion); vnetonePostdataBuilder.AppendFormat("&money={0}", money); vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode); OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi); if (orderChargeAccount == null) { order.RechargeMsg += "未取到v币帐号||"; totalPrice++; isContinue++; continue; } result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie, chargeVbiNum); #endregion #region 充值结果判断 if (result.Contains("成功") || result.Contains("您已成功充值") || result.Contains("成功充值")) { order.RechargeMsg += spoid + "充值成功||"; order.SuccessfulAmount += chargeVbiNum; orderChargeAccount.Balance = orderChargeAccount.Balance - chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } else if (result.Contains("请五分钟后再登陆商户网站进行帐户查询")) { order.RechargeMsg += spoid + "充值成功(请五分钟后再登陆商户网站进行帐户查询)||"; order.SuccessfulAmount += chargeVbiNum; orderChargeAccount.Balance = orderChargeAccount.Balance - chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } else if (result.Contains("操作失败")) { order.RechargeMsg += spoid + "操作失败||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("充值过于频繁")) { order.RechargeMsg += "充值频繁||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("验证码输入不正确")) { order.RechargeMsg += spoid + "验证码输入不正确||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); isContinue++; } else if (result.Contains("账户余额不足")) { order.RechargeMsg += "账户余额不足||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); isContinue++; } else if (result.Contains("支付密码不正确")) { order.RechargeMsg += spoid + "支付密码不正确||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); isContinue++; } else if (result.Contains("用户不存在")) { order.RechargeMsg += spoid + "用户不存在||"; totalPrice += chargeVbiNum; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false, false); isContinue++; } else { order.RechargeMsg += spoid + "存疑||"; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); } #endregion #endregion } #region 订单状态判断 if (order.SuccessfulAmount >= totalPriceFixed) { order.RechargeStatus = (int)OrderRechargeStatus.successful; } else if (order.SuccessfulAmount <= 0) { if (order.RechargeMsg.Contains("帐号不存在") || order.RechargeMsg.Contains("用户不存在")) { order.RechargeStatus = (int)OrderRechargeStatus.failure; } } else { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; } #endregion return(order); } catch (Exception ex) { order.RechargeStatus = (int)OrderRechargeStatus.suspicious; WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",充值异常信息:" + ex.Message, LogPathFile.Exception); return(order); } }
string ReCharge(Order order, string payment, ref string order_id) { #region 帐号登录 CookieContainer cookie = new CookieContainer(); if (!login(order, ref cookie)) { return("帐号登录失败"); } #endregion #region 获取参数 订单确认 string postURl = "https://my.xunyou.com/index.php/payment/confirmPayment2014"; StringBuilder postData = new StringBuilder(); postData.AppendFormat("payment_object={0}", System.Web.HttpUtility.UrlEncode(payment, Encoding.Default)); postData.AppendFormat("&isconversion={0}", "2"); postData.AppendFormat("&product_id={0}", "2"); postData.AppendFormat("&payment_login={0}", order.TargetAccount); postData.AppendFormat("&usernameinput={0}", order.TargetAccount); postData.AppendFormat("&payment_login_confirm={0}", order.TargetAccount); postData.AppendFormat("&payment_card={0}", "ICBC-NET"); postData.AppendFormat("&selected_product_name={0}", "%E8%BF%85%E6%B8%B8VIP"); postData.AppendFormat("&user_mask1={0}", ""); postData.AppendFormat("&user_mask2={0}", ""); postData.AppendFormat("&addition_product_id={0}", ""); postData.AppendFormat("&userid={0}", ""); postData.AppendFormat("&sub_product_class={0}", ""); postData.AppendFormat("&client={0}", " 0"); postData.AppendFormat("&payment_method={0}", "28"); postData.AppendFormat("&eid={0}", "10612"); postData.AppendFormat("&gameid={0}", "0"); postData.AppendFormat("&gid={0}", "0"); postData.AppendFormat("&cdkey={0}", "0"); postData.AppendFormat("&payment_card_account={0}", ""); postData.AppendFormat("&payment_card_password={0}", ""); postData.AppendFormat("&payment_bank={0}", "8001"); postData.AppendFormat("&vertifycode={0}", ""); postData.AppendFormat("&mobile_num={0}", ""); postData.AppendFormat("&packid={0}", "0"); postData.AppendFormat("&mac={0}", ""); postData.AppendFormat("&pageid={0}", "4"); postData.AppendFormat("&pwd={0}", ""); postData.AppendFormat("&spid={0}", ""); postData.AppendFormat("&spid2={0}", ""); string result = PostAndGet.HttpPostString(postURl, postData.ToString(), ref cookie, "https://my.xunyou.com/pay/?eid=10612"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第一步提交返回:" + result, LogPathFile.Recharge); if (result.Contains("用户不存在")) { return("用户不存在"); } if (result.Contains("请更换其他支付方式")) { return("帐号未设置安全工具"); } if (!result.Contains("确认订单")) { return("确认订单失败"); } #endregion #region Vbi钱包充值 string spid = Regex.Match(result, @"value=""(.*?)"" name=""spid""").Groups[1].Value; string spname = Regex.Match(result, @"value=""(.*?)"" name=""spname""").Groups[1].Value; string spoid = Regex.Match(result, @"value=""(.*?)"" name=""spoid""").Groups[1].Value; string spreq = Regex.Match(result, @"value=""(.*?)"" name=""spreq""").Groups[1].Value; string sprec = Regex.Match(result, @"value=""(.*?)"" name=""sprec""").Groups[1].Value; string userip = Regex.Match(result, @"value=""(.*?)"" name=""userip""").Groups[1].Value; string spcustom = Regex.Match(result, @"value=""(.*?)"" name=""spcustom""").Groups[1].Value; string spversion = Regex.Match(result, @"value=""(.*?)"" name=""spversion""").Groups[1].Value; string money = Regex.Match(result, @"value=""(.*?)"" name=""money""").Groups[1].Value; string urlcode = Regex.Match(result, @"value=""(.*?)"" name=""urlcode""").Groups[1].Value; string spmd5 = Regex.Match(result, @"value=""(.*?)"" name=""spmd5""").Groups[1].Value; string userid = Regex.Match(result, @"value=""(.*?)"" name=""userid""").Groups[1].Value; string payment_object = Regex.Match(result, @"value=""(.*?)"" name=""payment_object""").Groups[1].Value; string payment_orderid = Regex.Match(result, @"value=""(.*?)"" name=""payment_orderid""").Groups[1].Value; string payment_login = Regex.Match(result, @"value=""(.*?)"" name=""payment_login""").Groups[1].Value; string payment_product = Regex.Match(result, @"value=""(.*?)"" name=""payment_product""").Groups[1].Value; string payment_paymoney = Regex.Match(result, @"value=""(.*?)"" name=""payment_paymoney""").Groups[1].Value; StringBuilder vnetonePostdataBuilder = new StringBuilder(); vnetonePostdataBuilder.AppendFormat("spid={0}", spid); vnetonePostdataBuilder.AppendFormat("&spname={0}", System.Web.HttpUtility.UrlEncode(spname, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&spoid={0}", spoid); vnetonePostdataBuilder.AppendFormat("&spreq={0}", System.Web.HttpUtility.UrlEncode(spreq, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&sprec={0}", System.Web.HttpUtility.UrlEncode(sprec, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&userip={0}", userip); vnetonePostdataBuilder.AppendFormat("&spcustom={0}", spcustom); vnetonePostdataBuilder.AppendFormat("&spversion={0}", spversion); vnetonePostdataBuilder.AppendFormat("&money={0}", money); vnetonePostdataBuilder.AppendFormat("&urlcode={0}", urlcode); vnetonePostdataBuilder.AppendFormat("&spmd5={0}", spmd5); vnetonePostdataBuilder.AppendFormat("&userid={0}", userid); vnetonePostdataBuilder.AppendFormat("&payment_object={0}", System.Web.HttpUtility.UrlEncode(payment_object, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&payment_orderid={0}", payment_orderid); vnetonePostdataBuilder.AppendFormat("&payment_login={0}", payment_login); vnetonePostdataBuilder.AppendFormat("&payment_product={0}", System.Web.HttpUtility.UrlEncode(payment_product, Encoding.Default)); vnetonePostdataBuilder.AppendFormat("&payment_paymoney={0}", System.Web.HttpUtility.UrlEncode(payment_paymoney, Encoding.Default)); OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.Vbi); if (orderChargeAccount == null) { return("未取到v币帐号"); } result = VbiChargeHelper.VbiCharge(vnetonePostdataBuilder.ToString(), order, orderChargeAccount, cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",V币钱包充值返回:" + result, LogPathFile.Recharge); #endregion #region 迅游订单查询 result = PostAndGet.HttpGetString_XY("https://my.xunyou.com/index.php/payment/getOrderState/" + spoid, "", ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单查询结果:" + result, LogPathFile.Recharge); string xyOrderStatus = Regex.Match(result, @"{""state"":(.*?),").Groups[1].Value; string xyfpaysuccess = Regex.Match(result, @"""fpaysuccess"":""(.*?)"",").Groups[1].Value; order_id = spoid; if (xyOrderStatus == "1") { if (xyfpaysuccess == "1") { orderChargeAccount.Balance = orderChargeAccount.Balance - order.ProductParValue; SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); return("充值成功"); } else if (xyfpaysuccess == "0") { SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); return("未支付成功"); } else { SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); return("存疑"); } } else { SQLOrderChargeAccount.UpdateChargeAccount(orderChargeAccount, false); return("存疑"); } #endregion }