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 { int totalPrice = (int)order.BuyAmount; int totalPriceFixed = totalPrice; int isContinue = 0; if (CheckStrHelper.IsChinese(order.TargetAccount)) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "用户名不合法(4-32位数字字母和_组合)"; return(order); } //用户名不合法(4-32位数字字母和_组合) if (order.TargetAccount.Length < 4 || order.TargetAccount.Length > 32) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "用户名不合法(4-32位数字字母和_组合)"; return(order); } if (order.BuyAmount % 10 != 0) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "充值数量不正确"; return(order); } CookieContainer cookie = new CookieContainer(); string checkAccount = PostAndGet.HttpGetString("http://pay.web.7k7k.com/checkuser/?username="******"", ref cookie, "http://pay.web.7k7k.com/?qq-pf-to=pcqq.c2c"); WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount + ",帐号检测提交返回:" + checkAccount, LogPathFile.Recharge); string status = Regex.Match(checkAccount, @"""status"":""(.*?)""").Groups[1].Value; if (status.Equals("-1")) { order.RechargeStatus = (int)OrderRechargeStatus.failure; order.RechargeMsg = "帐号错误"; return(order); } string uid = Regex.Match(checkAccount, @"""uid"":(.*?)}").Groups[1].Value; while (totalPrice > 0) { if (isContinue >= 3) { break; //重试三次 } //totalPrice--; string result = "存疑"; string msg = ""; string CardNumber = string.Empty; int payNum = 0; if (!GetPayNum(totalPrice, ref payNum)) { isContinue++; continue; } else { totalPrice = totalPrice - payNum; } if (!string.IsNullOrEmpty(order.RechargeMsg) || !string.IsNullOrEmpty(CardNumber)) { System.Threading.Thread.Sleep(10 * 1000); } bool bo = ReCharge(order, payNum, uid, cookie, ref CardNumber, ref result, ref msg); order.RechargeMsg += msg; if (!string.IsNullOrEmpty(CardNumber)) { order.ChargeAccountInfo += CardNumber + "||"; } if (result.Contains("成功")) { order.SuccessfulAmount += payNum; } else if (result.Contains("失败")) { if (bo) { //重复提交 cookie = new CookieContainer(); totalPrice += payNum; isContinue++; } else { break; //订单失败直接返回 } } else { break; } } #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; 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); } }
void ChargeOrder(object obj) { Order order = (Order)obj; #region 订单判断 string payment = ""; if (!Getpayment((int)order.ProductParValue, ref payment)) { order.RechargeMsg = "充值面值不合法"; order.RechargeStatus = (int)OrderRechargeStatus.failure; return; } if (CheckStrHelper.IsChinese(order.TargetAccount)) { order.RechargeMsg = "充值帐号不能为中文"; order.RechargeStatus = (int)OrderRechargeStatus.failure; return; } if (order.TargetAccount.Length < 6 || order.TargetAccount.Length > 20) { order.RechargeMsg = "请输入6~20位字母和数字"; order.RechargeStatus = (int)OrderRechargeStatus.failure; return; } #endregion int count = 0; while (order.RechargeStatus == (int)OrderRechargeStatus.processing) { if (count > 3) { order.RechargeStatus = (int)OrderRechargeStatus.failure; break; } string order_id = string.Empty; string msg = ReCharge(order, payment, ref order_id); string orderStatus = OrderStatusForXml.GetOrderStatus("xunyou", msg); order.RechargeMsg += order_id + msg + "||"; switch (orderStatus) { case "成功": order.RechargeStatus = (int)OrderRechargeStatus.successful; break; case "失败": order.RechargeStatus = (int)OrderRechargeStatus.failure; break; case "重复": order.RechargeStatus = (int)OrderRechargeStatus.processing; break; case "可疑": order.RechargeStatus = (int)OrderRechargeStatus.suspicious; break; default: order.RechargeStatus = (int)OrderRechargeStatus.suspicious; break; } count++; } }