コード例 #1
0
        bool login(Order order, ref CookieContainer cookie)
        {
            try
            {
                OrderChargeAccount orderChargeAccount = SQLOrderChargeAccount.GetChargeAccount(OrderChargeAccountType.XunYou, false);

                cookie = Common.CookieOperation.CookieHelper.ReadCookiesFromDisk(orderChargeAccount.ChargeAccount);

                string result = PostAndGet.HttpGetString_XY("http://my.xunyou.com/index.php/uCenter/getLoginId", "", ref cookie);
                if (!result.Contains("-1"))
                {
                    return(true);
                }

                int loginCount = 0;
                while (loginCount < 5)
                {
                    result = PostAndGet.HttpGetString_XY("https://my.xunyou.com/u/", "", ref cookie);

                    string code   = ""; //验证码
                    int    codeid = 0;
                    WrapperHelp.GetCodeByByte_UU("https://my.xunyou.com/index.php/imageoutput/VertifyCode/ver_code_1/50/24", ref cookie, 1005, ref code, ref codeid);
                    string LoginData = "regfrom=uCenter&agree_rule=1&loginid=" + orderChargeAccount.ChargeAccount + "&password="******"&code=" + code;
                    string LoginUrl  = "https://my.xunyou.com/index.php/login/ajaxLoginGj";
                    result = PostAndGet.HttpPostString_XY(LoginUrl, LoginData, ref cookie, "my.xunyou.com", "https://my.xunyou.com/u/");
                    WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + orderChargeAccount.ChargeAccount + "||" + orderChargeAccount.ChargePassword
                                   + ",帐号登录返回:" + result, LogPathFile.Recharge);

                    string msg         = Regex.Match(result, @"""msg"":""(.*?)""").Groups[1].Value;
                    string encodingMsg = "";
                    TypeCast.GetString(msg, ref encodingMsg);

                    if (encodingMsg.Contains("登录成功"))
                    {
                        Common.CookieOperation.CookieHelper.WriteCookiesToDisk(orderChargeAccount.ChargeAccount, cookie);
                        return(true);
                    }
                    else
                    {
                        if (encodingMsg.Contains("验证码错误") || result.Contains("验证码错误"))
                        {
                            WrapperHelp.reportError(codeid);
                        }

                        loginCount++;
                        Thread.Sleep(1 * 1000);
                    }
                }
                return(false);
            }
            catch (Exception)
            {
                return(false);
            }
        }
コード例 #2
0
        public static string VbiCharge_Max(string data, Order order, OrderChargeAccount orderChargeAccount, CookieContainer cookie)
        {
            try
            {
                #region 固话钱包

                string result = PostAndGet.HttpPostString("http://s2.vnetone.com/Default.aspx", data, ref cookie);

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

                if (result.Contains("操作失败"))
                {
                    return("操作失败_F");
                }

                string __VIEWSTATE       = Regex.Match(result, @"id=""__VIEWSTATE"" value=""(.*?)"" />").Groups[1].Value;
                string __EVENTVALIDATION = Regex.Match(result, @"id=""__EVENTVALIDATION"" value=""(.*?)"" />").Groups[1].Value;

                #endregion

                #region 获取代充帐号
                string txtQBCard = orderChargeAccount.ChargeAccount; //代充账号
                string txtQBPwd  = orderChargeAccount.PayPassword;   //支付密码
                order.ChargeAccountInfo = order.ChargeAccountInfo + txtQBCard + "," + txtQBPwd + "||";
                #endregion

                #region 钱包最后一步提交
                int reChargeCount = 0;    //验证码重试次数
ReCharge:
                string txtQBValCode = ""; //验证码
                int codeid = 0;
                WrapperHelp.GetCodeByByte_UU("http://s2.vnetone.com/Validate/GetImageCodeSinWallet.aspx?time=148311417206464", ref cookie, 1004, ref txtQBValCode, ref codeid);

                StringBuilder PostdataBuilder = new StringBuilder();
                PostdataBuilder.AppendFormat("__VIEWSTATE={0}", System.Web.HttpUtility.UrlEncode(__VIEWSTATE, Encoding.UTF8));
                PostdataBuilder.AppendFormat("&__EVENTVALIDATION={0}", System.Web.HttpUtility.UrlEncode(__EVENTVALIDATION, Encoding.UTF8));
                PostdataBuilder.AppendFormat("&uid9qb={0}", System.Web.HttpUtility.UrlEncode(txtQBCard, Encoding.UTF8));
                PostdataBuilder.AppendFormat("&zfpwd9qb={0}", VbiChargeHelper.GetPwdMethod(new string[] { txtQBPwd }));
                PostdataBuilder.AppendFormat("&TextBox8={0}", txtQBValCode);
                PostdataBuilder.AppendFormat("&ImageButton1.x={0}", "62");
                PostdataBuilder.AppendFormat("&ImageButton1.y={0}", "10");

                result = PostAndGet.HttpPostString("http://s2.vnetone.com/Default.aspx", PostdataBuilder.ToString(), ref cookie, "http://s2.vnetone.com/Default.aspx");

                if (result.Contains("验证码输入不正确") && reChargeCount < 10)
                {
                    WrapperHelp.reportError(codeid);
                    reChargeCount++;
                    goto ReCharge;
                }

                WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                               + ",订单第四步提交参数:" + PostdataBuilder.ToString() + ",订单第四步提交返回:" + result, LogPathFile.Recharge);
                #endregion

                return(result);
            }
            catch (Exception ex)
            {
                WriteLog.Write("订单号:" + order.OrderInsideID + ",代充商品:" + order.ProductName + "代充帐号:" + order.TargetAccount
                               + ",充值异常信息:" + ex.Message, LogPathFile.Exception);
                return("充值异常");
            }
        }