コード例 #1
0
ファイル: Form1.cs プロジェクト: igit-cn/NearWechat
        private void DataLogin(bool isVerify)
        {
            Facade.LoginFacde loginFacde = new Facade.LoginFacde();


            Models.Request.Login62Data login62Requestl = new Login62Data();
            login62Requestl.Data62        = this.tb_62.Text;
            login62Requestl.UserName      = this.tb_username.Text;
            login62Requestl.Password      = this.tb_pwd.Text;
            login62Requestl.ProxyIp       = Config.ProxyConfig.Ip;
            login62Requestl.ProxyUserName = Config.ProxyConfig.UserName;
            login62Requestl.ProxyPassword = Config.ProxyConfig.UserPwd;


            if (!isVerify)
            {
                Models.Response.ResponseBase <Models.Response.Login62Data> login62Response = new Models.Response.ResponseBase <Models.Response.Login62Data>();
                if (!loginFacde.LoginBy62(ref login62Response, login62Requestl))
                {
                    Log(loginFacde.Msg);
                    return;
                }
                if (!login62Response.Success)
                {
                    Log(login62Response.Message);
                    return;
                }


                if (string.IsNullOrEmpty(login62Response.Data.accountInfo.wxid))
                {
                    Log(login62Response.Data.baseResponse.errMsg._string);

                    Models.Response.Login62Confirm login62Confirm = Tool.XmlHelper.Deserialize <Models.Response.Login62Confirm>(login62Response.Data.baseResponse.errMsg._string.Replace("\n", ""));

                    SetConfirmUrl(login62Confirm.Url);
                    return;
                }
                SetWwId(login62Response.Data.accountInfo.wxid);

                return;
            }

            Models.Response.ResponseBase <Models.Response.PassVerify> PassVerifyResponse = new Models.Response.ResponseBase <Models.Response.PassVerify>();
            if (!loginFacde.VerifyLoginBy62(ref PassVerifyResponse, login62Requestl))
            {
                Log(loginFacde.Msg);
                return;
            }
            if (!PassVerifyResponse.Success)
            {
                Log(PassVerifyResponse.Message);
                return;
            }
            if (string.IsNullOrEmpty(PassVerifyResponse.Data.accountInfo.wxid))
            {
                Log(PassVerifyResponse.Data.baseResponse.errMsg._string);
                return;
            }
            SetWwId(PassVerifyResponse.Data.accountInfo.wxid);


            //TODO:调心跳
        }
コード例 #2
0
ファイル: LoginFacde.cs プロジェクト: igit-cn/NearWechat
        public bool VerifyLoginBy62(ref Models.Response.ResponseBase <Models.Response.PassVerify> responseModel, Login62Data requestModel)
        {
            try
            {
                string requsetjson = JsonConvert.SerializeObject(requestModel);

                string json = Tool.HttpHelper.HttpPost(AppConfig.BaseUrl + AppConfig.Login_62Data, requsetjson, "application/json");

                responseModel = JsonConvert.DeserializeObject <Models.Response.ResponseBase <Models.Response.PassVerify> >(json);

                Msg = json;
                return(true);
            }
            catch (Exception e)
            {
                Msg = "404,网络异常请检查ip或端口";
                return(false);
            }
        }