Esempio n. 1
0
        private void Btn_getqrcode_Click(object sender, EventArgs e)
        {
            Facade.LoginFacde loginFacde = new Facade.LoginFacde();
            LoginQrCode       postData   = new LoginQrCode()
            {
                ProxyIp = Config.ProxyConfig.Ip, DeviceId = Config.ProxyConfig.DeviceId, ProxyUserName = Config.ProxyConfig.UserName, ProxyPassword = Config.ProxyConfig.UserPwd
            };

            Models.Response.LoginQrCode Responsemodel = new Models.Response.LoginQrCode();
            if (!loginFacde.GetLoginQrCode(ref Responsemodel, postData))
            {
                Log("网络异常请求失败!");
                return;
            }

            if (!Responsemodel.Success)
            {
                Log(Responsemodel.Message + ":" + Responsemodel.Code);
                return;
            }

            Image qrcode = Tool.ImageHelper.resizeImage(Tool.ImageHelper.Base64StringToImage(Responsemodel.Data.QrBase64), 200, 200);

            this.pic_qrcode.Image = qrcode;
            Log("Uuid:");
            Log(Responsemodel.Data.Uuid);
            Log("过期时间:");
            Log(Responsemodel.Data.ExpiredTime);
            this.lb_Uuid.Text = Responsemodel.Data.Uuid;

            Timer_CheckLogin.Elapsed += Timer_CheckLogin_Elapsed;
            Timer_CheckLogin.Interval = 2000;
            Timer_CheckLogin.Start();
        }
Esempio n. 2
0
        private void Timer_CheckLogin_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            lock (Lock_Islogin) {
                Facade.LoginFacde loginFacde = new Facade.LoginFacde();
                Models.Response.ResponseBase <Models.Response.CheckLogin> ResposecheckLogin = new Models.Response.ResponseBase <Models.Response.CheckLogin>();
                string uuid = this.lb_Uuid.Text;
                if (!loginFacde.CheckLogin(ref ResposecheckLogin, uuid))
                {
                    Log("404网络异常,请检查ip或端口配置");
                    Timer_CheckLogin.Stop();
                    return;
                }

                if (!ResposecheckLogin.Success)
                {
                    Log("协议异常,请检查服务端协议");
                    Timer_CheckLogin.Stop();
                    return;
                }

                if (ResposecheckLogin.Data.State == 0)
                {
                    Log("未扫码,等待中");
                    return;
                }
                if (ResposecheckLogin.Data.State == 1)
                {
                    Log("已扫码,待确认");
                    return;
                }


                Log("Uuid====" + ResposecheckLogin.Data.Uuid);
                Log("WxId====" + ResposecheckLogin.Data.WxId);
                Log("NickName====" + ResposecheckLogin.Data.NickName);
                Log("State====" + ResposecheckLogin.Data.State);
                Log("Device====" + ResposecheckLogin.Data.Device);
                Log("HeadUrl====" + ResposecheckLogin.Data.HeadUrl);
                Log("Mobile====" + ResposecheckLogin.Data.Mobile);
                Log("Email====" + ResposecheckLogin.Data.Email);
                Log("Alias====" + ResposecheckLogin.Data.Alias);

                SetWwId(ResposecheckLogin.Data.WxId);


                Timer_CheckLogin.Stop();


                System.Timers.Timer Timer_CheckLogin_Heatbeat = new System.Timers.Timer();
                Timer_CheckLogin_Heatbeat.Elapsed += Timer_CheckLogin_Heart_Elapsed;
                Timer_CheckLogin_Heatbeat.Interval = 10000;
                Timer_CheckLogin_Heatbeat.Start();
            }
        }
Esempio n. 3
0
        private void Btn_NewInit_Click(object sender, EventArgs e)
        {
            Facade.LoginFacde loginFacde = new Facade.LoginFacde();
            string            Wwid       = this.lb_Wxid.Text;
            string            json       = string.Empty;

            if (!loginFacde.NewInit(ref json, Wwid))
            {
                Log(loginFacde.Msg);
                return;
            }

            Log(json);
        }
Esempio n. 4
0
        private void Btn_twcLogin_Click(object sender, EventArgs e)
        {
            Facade.LoginFacde loginFacde = new Facade.LoginFacde();
            string            Wwid       = this.lb_Wxid.Text;
            string            json       = string.Empty;

            if (!loginFacde.TwiceLogin(ref json, Wwid))
            {
                Log("404网络异常,请检查ip或端口配置");
                return;
            }

            Log(json);
        }
Esempio n. 5
0
        private void Timer_CheckLogin_Heart_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            string uuid  = this.lb_Uuid.Text;
            string wwxid = this.lb_Wxid.Text;

            Facade.LoginFacde loginFacde = new Facade.LoginFacde();
            Models.Response.ResponseBase <Models.Response.HeartBeat> ResponseModel = new Models.Response.ResponseBase <Models.Response.HeartBeat>();
            if (!loginFacde.HeartBeat(ref ResponseModel, wwxid))
            {
                Log("404网络异常,请检查ip或端口配置");
                ((System.Timers.Timer)sender).Stop();
            }

            Log2(ResponseModel.Data.NextTime.ToString());
        }
Esempio n. 6
0
        private void Btn_get62_Click(object sender, EventArgs e)
        {
            Facade.LoginFacde loginFacde = new Facade.LoginFacde();


            string Wwid   = this.lb_Wxid.Text;
            string data62 = string.Empty;

            if (!loginFacde.Get62Data(ref data62, Wwid))
            {
                Log("404网络异常,请检查ip或端口配置");
                return;
            }

            Log(data62);
        }
Esempio n. 7
0
        private void Btn_confim_Click(object sender, EventArgs e)
        {
            Facade.LoginFacde       loginFacde = new Facade.LoginFacde();
            ExtDeviceLoginConfirmOK extDeviceLoginConfirmOK = new ExtDeviceLoginConfirmOK
            {
                LoginUrl = lb_ConfirmUrl.Text,
                WxId     = string.Empty
            };
            string json = string.Empty;

            if (!loginFacde.ConfirmLogin(ref json, extDeviceLoginConfirmOK))
            {
                Log(loginFacde.Msg);
                return;
            }
            Log(json);
        }
Esempio n. 8
0
        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:调心跳
        }