public static OrderChargeAccount GetChargeAccount(string typeCode, bool isReadonly = true) { try { int count = 0; do { if (count > 10) { break; } OrderChargeAccount account = GetChargeAccount_i(typeCode, isReadonly); if (account != null) { return(account); } count++; System.Threading.Thread.Sleep(5 * 1000); } while (true); } catch (Exception) { throw; } return(null); }
public static OrderChargeAccount GetChargeAccount_i(string typeCode, bool isReadonly) { try { ChargeAccountType AccountType = SQLChargeAccountType.GetChargeAccountType(p => p.Code == typeCode).FirstOrDefault(); OrderChargeAccount orderChargeAccount = GetOrderChargeAccount(p => p.ChargeAccountTypeID == AccountType.ChargeAccountTypeID && p.IsAvailable == true && p.IsUsing == false).OrderBy(p => p.UseTimes).FirstOrDefault(); if (orderChargeAccount == null) { return(null); } if (isReadonly) { orderChargeAccount.IsUsing = true; if (UpdateOrderChargeAccount(orderChargeAccount)) { return(orderChargeAccount); } } else { return(orderChargeAccount); } } catch (Exception) { } return(null); }
bool login(Order order, ref CookieContainer cookie) { try { OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.XunYou, false); cookie = Common.CookieOperation.CookieHelper.ReadCookiesFromDisk(orderChargeAccount.ChargeAccount); string result = PostAndGet.HttpGetString_XY("http://my.xunyou.com/index.php/uCenter/getLoginId", "", ref cookie); if (!result.Contains("-1")) { return(true); } int loginCount = 0; while (loginCount < 5) { result = PostAndGet.HttpGetString_XY("https://my.xunyou.com/u/", "", ref cookie); string code = ""; //验证码 int codeid = 0; WrapperHelp.GetCodeByByte_UU("https://my.xunyou.com/index.php/imageoutput/VertifyCode/ver_code_1/50/24", ref cookie, 1005, ref code, ref codeid); string LoginData = "regfrom=uCenter&agree_rule=1&loginid=" + orderChargeAccount.ChargeAccount + "&password="******"&code=" + code; string LoginUrl = "https://my.xunyou.com/index.php/login/ajaxLoginGj"; result = PostAndGet.HttpPostString_XY(LoginUrl, LoginData, ref cookie, "my.xunyou.com", "https://my.xunyou.com/u/"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + orderChargeAccount.ChargeAccount + "||" + orderChargeAccount.ChargePassword + ",帐号登录返回:" + result, LogPathFile.Recharge); string msg = Regex.Match(result, @"""msg"":""(.*?)""").Groups[1].Value; string encodingMsg = ""; TypeCast.GetString(msg, ref encodingMsg); if (encodingMsg.Contains("登录成功")) { Common.CookieOperation.CookieHelper.WriteCookiesToDisk(orderChargeAccount.ChargeAccount, cookie); return(true); } else { if (encodingMsg.Contains("验证码错误") || result.Contains("验证码错误")) { WrapperHelp.reportError(codeid); } loginCount++; Thread.Sleep(1 * 1000); } } return(false); } catch (Exception) { return(false); } }
/// <summary> /// /// </summary> /// <param name="data"></param> /// <param name="order"></param> /// <param name="orderChargeAccount"></param> /// <param name="cookie"></param> /// <param name="PayNum">充值数量</param> /// <returns></returns> public static string VbiCharge(string data, Order order, OrderChargeAccount orderChargeAccount, CookieContainer cookie, int PayNum = 0) { if (PayNum >= 100) { return(VbiCharge_Max(data, order, orderChargeAccount, cookie)); } else { return(VbiCharge_Mix(data, order, orderChargeAccount, cookie)); } }
public static bool UpdateOrderChargeAccount(OrderChargeAccount orderChargeAccount) { try { using (DCLEntities dcl = new DCLEntities()) { dcl.Entry(orderChargeAccount).State = System.Data.Entity.EntityState.Modified; return(dcl.SaveChanges() > 0); } } catch (Exception) { return(false); } }
public static bool AddOrderChargeAccount(OrderChargeAccount orderChargeAccount) { try { using (DCLEntities dcl = new DCLEntities()) { orderChargeAccount = dcl.OrderChargeAccount.Add(orderChargeAccount); return(dcl.SaveChanges() > 0); } } catch (Exception) { return(false); } }
bool DeleteAccount(DataGridViewRow row) { try { int OrderChargeAccountID = Convert.ToInt32(row.Cells["OrderChargeAccountID"].Value); OrderChargeAccount account = SQLOrderChargeAccount.GetOrderChargeAccount(p => p.OrderChargeAccountID == OrderChargeAccountID).FirstOrDefault(); return(SQLOrderChargeAccount.DeleteOrderChargeAccount(account)); } catch (Exception) { } return(false); }
public static bool DeleteOrderChargeAccount(OrderChargeAccount orderChargeAccount) { try { using (DCLEntities dcl = new DCLEntities()) { dcl.OrderChargeAccount.Attach(orderChargeAccount); dcl.OrderChargeAccount.Remove(orderChargeAccount); return(dcl.SaveChanges() > 0); } } catch (Exception) { return(false); } }
public static bool UpdateChargeAccount(OrderChargeAccount orderChargeAccount, bool isUsing, bool IsAvailable = true) { try { orderChargeAccount.LastUseTime = DateTime.Now; if (orderChargeAccount.UseTimes == null) { orderChargeAccount.UseTimes = 0; } orderChargeAccount.UseTimes++; orderChargeAccount.IsUsing = isUsing; orderChargeAccount.IsAvailable = IsAvailable; return(UpdateOrderChargeAccount(orderChargeAccount)); } catch (Exception) { return(false); } }
bool UpdateAccount(DataGridViewRow row) { try { int OrderChargeAccountID = Convert.ToInt32(row.Cells["OrderChargeAccountID"].Value); OrderChargeAccount account = SQLOrderChargeAccount.GetOrderChargeAccount(p => p.OrderChargeAccountID == OrderChargeAccountID).FirstOrDefault(); account.ChargeAccountTypeID = Convert.ToInt32(row.Cells["ChargeAccountTypeID"].Value); account.ChargeAccount = Convert.ToString(row.Cells["ChargeAccount"].Value); account.ChargePassword = Convert.ToString(row.Cells["ChargePassword"].Value); account.PayPassword = Convert.ToString(row.Cells["PayPassword"].Value); account.Balance = Convert.ToDecimal(row.Cells["Balance"].Value); account.IsAvailable = Convert.ToBoolean(row.Cells["IsAvailable"].Value); return(SQLOrderChargeAccount.UpdateOrderChargeAccount(account)); } catch (Exception) { } return(false); }
OrderChargeAccount AssignmentOrderChargeAccountFormText() { if (!CheckOrderChargeAccountText()) { MessageBox.Show("值不能为空!"); return(null); } OrderChargeAccount orderChargeAccount = new OrderChargeAccount(); orderChargeAccount.ChargeAccountTypeID = (int)CmbAccountType.SelectedValue; orderChargeAccount.ChargeAccount = TxtAccountName.Text; orderChargeAccount.ChargePassword = TxtAccountPwd.Text; orderChargeAccount.PayPassword = TxtPayPwd.Text; orderChargeAccount.ParValue = Convert.ToInt32(TxtPayValue.Text); orderChargeAccount.Balance = Convert.ToDecimal(TxtBalance.Text); orderChargeAccount.IsAvailable = chkLive.Checked; orderChargeAccount.IsUsing = false; orderChargeAccount.CreateTime = DateTime.Now; orderChargeAccount.LastUseTime = orderChargeAccount.CreateTime; return(orderChargeAccount); }
bool login(Order order, ref CookieContainer cookie) { try { int loginCount = 0; while (loginCount < 5) { cookie = new CookieContainer(); string result = PostAndGet.HttpGetString("http://login.sns.hongxiu.com/comlogin.aspx?url=http%3A//www.hongxiu.com/", "", ref cookie); string comLoginUrl = "http://login.sns.hongxiu.com/comlogin.aspx?url=http://pay.hongxiu.com"; OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.HongXiu, false); string comLoginData = "htmlUserName="******"&htmlPassword="******"&iskeeplogin=true&x=43&y=10&postcontent="; result = PostAndGet.HttpPostString_HX(comLoginUrl, comLoginData, ref cookie, "login.sns.hongxiu.com", "http://pay.hongxiu.com/default.shtml"); result = PostAndGet.HttpGetString("http://pay.hongxiu.com/model/GetUserBaseInfo.aspx?roundmun=0.5841341522289687", "", ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + orderChargeAccount.ChargeAccount + "||" + orderChargeAccount.ChargePassword + ",帐号登录返回:" + result, LogPathFile.Recharge); if (result.Contains(orderChargeAccount.ChargeAccount)) { return(true); } else { loginCount++; Thread.Sleep(1 * 1000); } } return(false); } catch (Exception) { return(false); } }
private void btnSaveAccount_Click(object sender, EventArgs e) { try { OrderChargeAccount orderChargeAccount = AssignmentOrderChargeAccountFormText(); if (orderChargeAccount != null) { if (SQLOrderChargeAccount.AddOrderChargeAccount(orderChargeAccount)) { MessageBox.Show("添加成功"); this.DialogResult = DialogResult.Yes; } else { MessageBox.Show("添加失败"); } } } catch (Exception) { MessageBox.Show("添加失败"); } }
public static string VbiCharge_Max(string data, Order order, OrderChargeAccount orderChargeAccount, CookieContainer cookie) { try { #region 固话钱包 string result = PostAndGet.HttpPostString("http://s2.vnetone.com/Default.aspx", data, ref cookie); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第三步提交返回:" + result, LogPathFile.Recharge); if (result.Contains("操作失败")) { return("操作失败_F"); } string __VIEWSTATE = Regex.Match(result, @"id=""__VIEWSTATE"" value=""(.*?)"" />").Groups[1].Value; string __EVENTVALIDATION = Regex.Match(result, @"id=""__EVENTVALIDATION"" value=""(.*?)"" />").Groups[1].Value; #endregion #region 获取代充帐号 string txtQBCard = orderChargeAccount.ChargeAccount; //代充账号 string txtQBPwd = orderChargeAccount.PayPassword; //支付密码 order.ChargeAccountInfo = order.ChargeAccountInfo + txtQBCard + "," + txtQBPwd + "||"; #endregion #region 钱包最后一步提交 int reChargeCount = 0; //验证码重试次数 ReCharge: string txtQBValCode = ""; //验证码 int codeid = 0; WrapperHelp.GetCodeByByte_UU("http://s2.vnetone.com/Validate/GetImageCodeSinWallet.aspx?time=148311417206464", ref cookie, 1004, ref txtQBValCode, ref codeid); StringBuilder PostdataBuilder = new StringBuilder(); PostdataBuilder.AppendFormat("__VIEWSTATE={0}", System.Web.HttpUtility.UrlEncode(__VIEWSTATE, Encoding.UTF8)); PostdataBuilder.AppendFormat("&__EVENTVALIDATION={0}", System.Web.HttpUtility.UrlEncode(__EVENTVALIDATION, Encoding.UTF8)); PostdataBuilder.AppendFormat("&uid9qb={0}", System.Web.HttpUtility.UrlEncode(txtQBCard, Encoding.UTF8)); PostdataBuilder.AppendFormat("&zfpwd9qb={0}", VbiChargeHelper.GetPwdMethod(new string[] { txtQBPwd })); PostdataBuilder.AppendFormat("&TextBox8={0}", txtQBValCode); PostdataBuilder.AppendFormat("&ImageButton1.x={0}", "62"); PostdataBuilder.AppendFormat("&ImageButton1.y={0}", "10"); result = PostAndGet.HttpPostString("http://s2.vnetone.com/Default.aspx", PostdataBuilder.ToString(), ref cookie, "http://s2.vnetone.com/Default.aspx"); if (result.Contains("验证码输入不正确") && reChargeCount < 10) { WrapperHelp.reportError(codeid); reChargeCount++; goto ReCharge; } WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",订单第四步提交参数:" + PostdataBuilder.ToString() + ",订单第四步提交返回:" + result, LogPathFile.Recharge); #endregion return(result); } catch (Exception ex) { WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",充值异常信息:" + ex.Message, LogPathFile.Exception); return("充值异常"); } }
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); } }
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 { 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); } }
bool login(Order order, ref CookieContainer cookie) { try { //OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.JiuYou, false); OrderChargeAccount orderChargeAccount = new OrderChargeAccount() { ChargeAccount = "15072412234", ChargePassword = "******" }; cookie = Common.CookieOperation.CookieHelper.ReadCookiesFromDisk(orderChargeAccount.ChargeAccount); string result = string.Empty; result = PostAndGet.HttpGetString("http://pay.9you.com/pay", "", ref cookie); if (result.Contains("欢迎您") && result.Contains("退出")) { return(true); } int loginCount = 0; while (loginCount < 5) { cookie = new CookieContainer(); //ssosessionid=974ad182-625f-4783-afbc-9c67c105df7b; domain=.9you.com; path=/ Cookie ck = new Cookie { Domain = ".9you.com", Name = "ssosessionid", Value = "06514a9c-de8a-48f9-adbd-4986b7a92949", Path = "/" }; cookie.Add(ck); result = PostAndGet.HttpGetString_9Y("https://login.passport.9you.com/", "", ref cookie, "login.passport.9you.com"); StringBuilder Data = new StringBuilder(); Data.AppendFormat("id={0}", "null"); Data.AppendFormat("&userName={0}", orderChargeAccount.ChargeAccount); Data.AppendFormat("&password={0}", orderChargeAccount.ChargePassword); Data.AppendFormat("&sourceUrl={0}", "login.jsp"); Data.AppendFormat("&continue={0}", "null"); Data.AppendFormat("&userIp={0}", "null"); Data.AppendFormat("&mw={0}", ""); Data.AppendFormat("&ekeyPassword={0}", ""); Data.AppendFormat("&otpPassword={0}", ""); Data.AppendFormat("&s={0}", "null"); result = PostAndGet.HttpPostString_9Y("https://login.passport.9you.com/checkCode", Data.ToString(), ref cookie, "login.passport.9you.com", "https://login.passport.9you.com/"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + orderChargeAccount.ChargeAccount + "||" + orderChargeAccount.ChargePassword + ",帐号登录返回:" + result, LogPathFile.Recharge); result = PostAndGet.HttpGetString("http://pay.9you.com/pay", "", ref cookie); if (result.Contains("欢迎您") && result.Contains("退出")) { //登录成功 Common.CookieOperation.CookieHelper.WriteCookiesToDisk(orderChargeAccount.ChargeAccount, cookie); return(true); } else { loginCount++; Thread.Sleep(1 * 1000); } } return(false); } catch (Exception) { return(false); } }
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 }