Ejemplo n.º 1
0
        /// <summary>
        /// 从数网获取订单
        /// </summary>
        /// <param name="merchantID">商户编号</param>
        /// <param name="key">商户密码</param>
        /// <param name="url">接口地址</param>
        /// <param name="count">订单数量</param>
        /// <returns></returns>
        public List <Order> getOrderFromSW(ref int getOrderTime)
        {
            getOrderTime = time;

            List <Order> orderSet = new List <Order>();

            try
            {
                string sign     = Md5Helper.MD5Encrypt(merchantID + key);
                string postData = string.Format("MerchantID={0}&Count={1}&Sign={2}", merchantID, count, sign);


                System.Net.CookieContainer cookie = new System.Net.CookieContainer();

                string result = PostAndGet.HttpGetString(getOrderurl, postData, ref cookie);

                WriteLog.Write("方法:getOrderFromSW 获取订单信息:" + result, LogPathFile.Other);

                if (result.Contains("获取成功"))
                {
                    assignmentOrder(orderSet, result);
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write("方法:getOrderFromSW异常,信息:" + ex.Message + ex.StackTrace, LogPathFile.Exception);
            }

            return(orderSet);
        }
Ejemplo n.º 2
0
        void ChargeOrder(object obj)
        {
            Order           order        = (Order)obj;
            CookieContainer cookie       = new CookieContainer();
            string          checkAccount = PostAndGet.HttpGetString("https://pay.91y.com/servlet/do.ashx?a=changeuser&acc=" + order.TargetAccount + "&t=0.48772043911252916", "", ref cookie, "https://pay.91y.com/tel/");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",帐号检测提交返回:" + checkAccount, LogPathFile.Recharge);

            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.RechargeMsg    = "帐号错误";
                order.RechargeStatus = (int)OrderRechargeStatus.failure;
                return;
            }

            int count = 0;

            while (order.RechargeStatus == (int)OrderRechargeStatus.processing)
            {
                if (count > 3)
                {
                    order.RechargeStatus = (int)OrderRechargeStatus.failure;
                    break;
                }

                string orderMsg    = ReCharge(order, Accounts, cookie);
                string orderStatus = OrderStatusForXml.GetOrderStatus("91y", orderMsg);

                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++;
            }
        }
Ejemplo n.º 3
0
        public static void VerificationFor91y(System.Net.CookieContainer cookie)
        {
            string url   = "http://123.206.33.187:9000/crack/aLiYun";
            string key   = "FFFF00000000016860BF";
            string scene = "login";
            //FFFF00000000016860BF:1511432977354:0.8646665122863599
            string t      = key + ":" + GetTimeLikeJS() + ":0.8646665122863599";
            string userid = "469FB388E2844B90A55E44D99852DE67";

            string data   = key + "&" + scene + "&" + t + "&" + userid;
            string result = PostAndGet.HttpGetString(url, data, ref cookie);
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        public List <Order> getOrderFromSUP(ref int getOrderTime)
        {
            getOrderTime = time;

            List <Order> orderSet = new List <Order>();

            try
            {
                string sign     = Md5Helper.GetMD5String_utf8(merchantID + key);
                string postData = string.Format("MerchantID={0}&Sign={1}&ProductNo={2}&Count={3}&Status={4}", merchantID, sign, "", count, "0");

                System.Net.CookieContainer cookie = new System.Net.CookieContainer();

                WriteLog.Write("方法:getOrderFromSUP 获取订单参数:" + postData, LogPathFile.Other);

                string result = PostAndGet.HttpGetString(getOrderurl, postData, ref cookie);

                WriteLog.Write("方法:getOrderFromSUP 获取订单信息:" + result, LogPathFile.Other);



                string State = Regex.Match(result, @"<State>(.*?)</State>").Groups[0].Value;

                string State_Info = Regex.Match(result, @"<State_Info>(.*?)</State_Info>").Groups[0].Value;

                if (State.Contains("0") && State_Info.Contains("成功"))
                {
                    assignmentOrder(orderSet, result);
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write("方法:getOrderFromSUP异常,信息:" + ex.Message + ex.StackTrace, LogPathFile.Exception);
            }

            return(orderSet);
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
0
        public void getmoyuAreaAndServer(string gamename, string areaname, string servername, ref string areaid, ref string serverid)
        {
            try
            {
                string url = "https://xmlserver.99.com/my/mycharge.xml?0.8311741468522764";

                switch (gamename)
                {
                case "魔域":
                    url = "https://xmlserver.99.com/my/mycharge.xml?0.8311741468522764";
                    break;

                case "魔域掉钱版":
                    url = "https://xmlserver.99.com/my/Chsjmy.xml?0.5738079243209351";
                    break;

                case "魔域口袋版":
                    url = "https://xmlserver.99.com/my/mysjcharge.xml?0.3160789587639954";
                    break;

                case "机战":
                    url = "https://xmlserver.99.com//jz/jzcharge.xml?0.8663311481081863";
                    break;

                case "征服":
                    url = "https://xmlserver.99.com/zf/zfcharge.xml?0.9778757448608422";
                    break;

                default:
                    url = "https://xmlserver.99.com/my/mycharge.xml?0.8311741468522764";
                    break;
                }

                Dictionary <string, string> dicArea = new Dictionary <string, string>();

                Dictionary <string, List <Dictionary <string, string> > > dicServer = new Dictionary <string, List <Dictionary <string, string> > >();


                CookieContainer coockie = new CookieContainer();
                string          result  = PostAndGet.HttpGetString(url, "", ref coockie);

                XmlDocument docArea = new XmlDocument();
                docArea.LoadXml(result);                                            //加载Xml文件
                XmlElement  rootArea  = docArea.DocumentElement;                    //获取根节点
                XmlNodeList AreaNodes = rootArea.GetElementsByTagName("MainTable"); //获取area
                foreach (XmlNode node in AreaNodes)
                {
                    //string Code = ((XmlElement)node).GetAttribute("Code");   //获取Code属性值

                    string key  = ((XmlElement)node).GetElementsByTagName("key")[0].InnerText;
                    string name = ((XmlElement)node).GetElementsByTagName("name")[0].InnerText;
                    dicArea.Add(key, name);
                }

                XmlDocument docServer = new XmlDocument();
                docServer.LoadXml(result);                                             //加载Xml文件
                XmlElement  rootServer  = docServer.DocumentElement;                   //获取根节点
                XmlNodeList ServerNodes = rootServer.GetElementsByTagName("SubTable"); //获取sever
                foreach (XmlNode node in ServerNodes)
                {
                    string key       = ((XmlElement)node).GetElementsByTagName("key")[0].InnerText;
                    string name      = ((XmlElement)node).GetElementsByTagName("name")[0].InnerText;
                    string ParentKey = ((XmlElement)node).GetElementsByTagName("ParentKey")[0].InnerText;

                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add(key, name);
                    bool isNew = true;

                    foreach (string serverkey in dicServer.Keys)
                    {
                        if (ParentKey == serverkey)
                        {
                            dicServer[serverkey].Add(dic);
                            isNew = false;
                            break;
                        }
                    }

                    if (isNew)
                    {
                        List <Dictionary <string, string> > lst = new List <Dictionary <string, string> >();
                        lst.Add(dic);
                        dicServer.Add(ParentKey, lst);
                    }
                }

                if (!string.IsNullOrEmpty(areaname))
                {
                    foreach (string item in dicArea.Keys)
                    {
                        if (dicArea[item] == areaname)
                        {
                            areaid = item;
                            break;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(areaname) && !string.IsNullOrEmpty(servername))
                {
                    foreach (string key in dicArea.Keys)
                    {
                        if (dicArea[key] == areaname)
                        {
                            foreach (string parentKey in dicServer.Keys)
                            {
                                if (parentKey == key)
                                {
                                    foreach (Dictionary <string, string> dic in dicServer[parentKey])
                                    {
                                        foreach (string serverkey in dic.Keys)
                                        {
                                            if (servername == dic[serverkey])
                                            {
                                                serverid = serverkey;
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog.Write("方法:getmoyuAreaAndServer,异常:" + ex.Message, LogPathFile.Exception.ToString());
                throw;
            }
        }
Ejemplo n.º 9
0
        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);
            }
        }
Ejemplo n.º 10
0
        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);
            }
        }
Ejemplo n.º 11
0
        string ReCharge(Order order, string Accounts, CookieContainer cookie)
        {
            #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}", "ZONGY-NET");
            tradeverifyStr.AppendFormat("&pay_amount={0}", (int)order.ProductParValue);
            tradeverifyStr.AppendFormat("&pay_type={0}", "5");
            tradeverifyStr.AppendFormat("&pay_subtype={0}", "0");
            tradeverifyStr.AppendFormat("&step={0}", "2");
            string result = PostAndGet.HttpPostString_HX(tradeverifyUrl, tradeverifyStr.ToString(), ref cookie, "pay.91y.com", "https://pay.91y.com/gamecard/");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",订单第一步提交返回:" + result, LogPathFile.Recharge);

            if (result.Contains("无法继续充值"))
            {
                string msg = "充值已达每日上限";
                order.RechargeMsg = msg;
                return(msg);
            }

            if (result.Contains("用户不存在"))
            {
                string msg = "用户不存在";
                order.RechargeMsg = msg;
                return(msg);
            }

            if (result.Contains("所选金额会超出每日限额"))
            {
                string msg = "所选金额会超出每日限额";
                order.RechargeMsg = msg;
                return(msg);
            }

            if (result.Contains("订单提交失败"))
            {
                string msg = "订单提交失败";
                order.RechargeMsg = msg;
                return(msg);
            }

            #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/yeepay/Index.shtml";

            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(servletUrl, servletStr.ToString(), ref cookie);

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",订单第二步提交返回:" + result, LogPathFile.Recharge);

            if (!result.Contains("确认提交"))
            {
                string msg = "确认提交订单失败";
                order.RechargeMsg = msg;
                return(msg);
            }


            #endregion

            #region 纵游卡提交

            Cards cards = SQLCards.GetChargeCards(OrderChargeAccountType.ZYCard, (decimal)order.ProductParValue);

            if (cards == null)
            {
                string msg = "取卡失败";
                order.RechargeMsg = msg;
                return(msg);
            }

            string a         = "yeepay";
            string orderId   = Regex.Match(result, @"id=""pay_OrderId""\s+name=""pay_OrderId""\s+value=""(.*?)""").Groups[1].Value;
            string paymoney  = Regex.Match(result, @"id=""pay_amount""\s+name=""pay_amount""\s+value=""(.*?)""").Groups[1].Value;
            string cardType  = "ZONGY-NET";
            string payUser   = Regex.Match(result, @"id=""pay_User""\s+name=""pay_ItemUser""\s+value=""(.*?)""").Groups[1].Value;
            string payUserID = Regex.Match(result, @"id=""pay_UserID""\s+name=""pay_UserID""\s+value=""(.*?)""").Groups[1].Value;
            string cardId    = cards.CardNumber;
            string cardPsw   = cards.CardPassWord;
            string t         = "0.08686665393995474";

            string        yeepayUrl = "https://pay.91y.com/servlet/do.ashx";
            StringBuilder yeepayStr = new StringBuilder();
            yeepayStr.AppendFormat("a={0}", a);
            yeepayStr.AppendFormat("&orderId={0}", orderId);
            yeepayStr.AppendFormat("&paymoney={0}", paymoney);
            yeepayStr.AppendFormat("&cardType={0}", cardType);
            yeepayStr.AppendFormat("&payUser={0}", payUser);
            yeepayStr.AppendFormat("&payUserID={0}", payUserID);
            yeepayStr.AppendFormat("&cardId={0}", cardId);
            yeepayStr.AppendFormat("&cardPsw={0}", cardPsw);
            yeepayStr.AppendFormat("&t={0}", t);
            result = PostAndGet.HttpGetString(yeepayUrl, yeepayStr.ToString(), ref cookie, "https://pay.91y.com/yeepay/Index.shtml");

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",纵游卡提交返回:" + result, LogPathFile.Recharge);

            if (result.Contains("输入字符串的格式不正确"))
            {
                string msg = "输入字符串的格式不正确";
                order.RechargeMsg = msg;
                return(msg);
            }

            #endregion

            #region 查询卡密结果

            int queryCount = 0;
ReQuery:
            if (queryCount > 10)
            {
                string msg = "查询卡密充值结果超时";
                order.RechargeMsg = orderId + msg;

                SQLCards.UpdateCards_ByMultiple(cards, (int)OrderRechargeStatus.successful, orderId + msg);

                return(msg);
            }
            queryCount++;
            StringBuilder yeepaycheck = new StringBuilder();
            yeepaycheck.AppendFormat("a={0}", "yeepaycheck");
            yeepaycheck.AppendFormat("&orderId={0}", orderId);
            yeepaycheck.AppendFormat("&userID={0}", payUserID);
            yeepaycheck.AppendFormat("&t={0}", t);
            result = PostAndGet.HttpGetString(yeepayUrl, yeepaycheck.ToString(), ref cookie);

            WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                           + ",纵游卡提交结果查询返回:" + result, LogPathFile.Recharge);

            if (result.Contains("充值失败"))
            {
                string msg = "充值失败(充值失败,请确认您的卡号密码后重试)";
                order.RechargeMsg = orderId + msg;;

                SQLCards.UpdateCards_ByMultiple(cards, (int)OrderRechargeStatus.successful, orderId + msg);

                return(msg);
            }
            else if (result.Contains("充值成功"))
            {
                string msg = "充值成功";
                order.RechargeMsg = orderId + msg;

                SQLCards.UpdateCards_ByMultiple(cards, (int)OrderRechargeStatus.successful, orderId + msg);
                return(msg);
            }
            else if (result.Contains("提交失败"))
            {
                string msg = "";

                if (result.Contains("订单号重复"))
                {
                    msg = "订单号重复||";
                }
                else
                {
                    msg = "订单提交失败||";
                }

                order.RechargeMsg = msg;

                SQLCards.UpdateCards_ByMultiple(cards, (int)OrderRechargeStatus.untreated, msg);

                return(msg);
            }
            else
            {
                System.Threading.Thread.Sleep(1000);
                goto ReQuery;
            }
            #endregion 查询卡密结果
        }
Ejemplo n.º 12
0
        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);
            }
        }