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); } }