Example #1
0
        private void InitZfbSQ()
        {
            if (IsInitZfbSQloaded)
            {
                return;
            }


            IsInitZfbSQloaded = true;
            // 导航至添加密保(选择添加密保的方式)
            Operation zfb_reg_queryStrategy = new Operation(MainCefFrame);

            zfb_reg_queryStrategy.index             = 21;
            zfb_reg_queryStrategy.PerviousStatus    = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion_before;
            zfb_reg_queryStrategy.CurrentUrl        = "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-addSecurityQuestion-fullpage&scene_code=addSecurityQuestion";
            zfb_reg_queryStrategy.NextStatus        = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion;
            zfb_reg_queryStrategy.OperationHandler += (s, e) => {
                MainCefFrame.LoadUrl(GlobalVar.zfb_reg_nav2set_SecurityQuestion);
            };

            //导航至支付宝密保
            Operation nav2set_SQ = new Operation(MainCefFrame);

            nav2set_SQ.index             = 22;
            nav2set_SQ.PerviousStatus    = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion;//
            nav2set_SQ.NextStatus        = BusinessStatus.zfb_reg_nav2set_SecurityQuestion;
            nav2set_SQ.OperationHandler += BT_zfb_reg_nav2set_SecurityQuestion_Click;
            nav2set_SQ.CurrentUrl        = "https://accounts.alipay.com/console/selectStrategy.htm?sp=1-addSecurityQuestion-fullpage&strategy=payment_password";// GlobalVar.zfb_reg_queryStrategy2;

            //填支付密码
            Operation add_SQ = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_reg_nav2set_SecurityQuestion,
                NextStatus     = BusinessStatus.zfb_reg_add_SecurityQuestion_Fill_PayPwd,
                CurrentUrl     = "https://accounts.alipay.com/console/selectStrategy.htm?sp=1-addSecurityQuestion-fullpage&strategy=payment_password"
                ,
                index = 23
            };

            add_SQ.OperationHandler += BT_zfb_reg_add_SecurityQuestion_Fill_PayPwd_Click;

            //填写安保
            Operation setQa = new Operation(MainCefFrame)
            {
                PerviousStatus = BusinessStatus.zfb_reg_add_SecurityQuestion_Fill_PayPwd,
                NextStatus     = BusinessStatus.zfb_reg_setQa,
                CurrentUrl     = GlobalVar.zfb_reg_setQa
                ,
                index = 24
            };

            setQa.OperationHandler += BT_zfb_reg_add_SecurityQuestion_Click;

            Operation setQa_confirm = new Operation(MainCefFrame)
            {
                index          = 25,
                PerviousStatus = BusinessStatus.zfb_reg_setQa,
                NextStatus     = BusinessStatus.zfb_reg_add_SecurityQuestion_setQa_confirm,
                CurrentUrl     = GlobalVar.zfb_reg_add_SecurityQuestion_setQa_confirm
            };

            setQa_confirm.OperationHandler += BT_zfb_reg_add_SecurityQuestion_setQa_confirm_Click;

            Operation add_sq_sucess = new Operation(MainCefFrame)
            {
                index          = 26,
                PerviousStatus = BusinessStatus.zfb_reg_add_SecurityQuestion_setQa_confirm,
                NextStatus     = BusinessStatus.zfb_reg_open_tb_before,
                CurrentUrl     = "https://accounts.alipay.com/console/common/success.htm"
            };

            add_sq_sucess.OperationHandler += Add_SQ_SUCESS;
            //

            //=========解绑手机
            Operation nav2jiebang = new Operation(MainCefFrame)
            {
                index          = 3.1,
                PerviousStatus = BusinessStatus.Zfb_reg_shifou_bangding_shouji_before,
                NextStatus     = BusinessStatus.Zfb_reg_shifou_bangding_shouji,
                CurrentUrl     = "https://my.alipay.com/portal/account/index.htm",
                note           = "主页至解绑页"
            };

            nav2jiebang.OperationHandler += (s, e) => {
                var res = CefFrameHelper.GetMsgByJs2(MainCefFrame,
                                                     "document.getElementsByClassName('account-status-det')[2].getElementsByClassName('fn-left')[1].innerText", "gb2312");
                LogManager.WriteLog(res);
                if (!string.IsNullOrEmpty(res) && res.Trim() == "未绑定")  //未绑定
                // state= tb_ TODO:
                {
                    BT_ZFB_REG_nav2addsq_Click(s, e);//导航至添加密保
                }
                else
                {
                    MainCefFrame.LoadUrl("https://accounts.alipay.com/console/dispatch.htm?scene_code=removeMobile&site=1&page_type=fullpage");
                }
            };

            Operation removeMobile0 = new Operation(MainCefFrame)
            {
                index          = 3.2,
                PerviousStatus = BusinessStatus.Zfb_reg_shifou_bangding_shouji,
                NextStatus     = BusinessStatus.Zfb_reg_removeMobile0,
                CurrentUrl     = "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-removeMobile-fullpage&scene_code=removeMobile",
                note           = "选择解绑方式1-身份证"
            };

            removeMobile0.OperationHandler += (s, e) => {
                MainCefFrame.LoadUrl("https://accounts.alipay.com/console/selectStrategy.htm?sp=1-removeMobile-fullpage&strategy=email-id_card_raw-payment_password");
            };

            //Operation removeMobile0 = new Operation(MainCefFrame) {
            //    index = 3.2,
            //    PerviousStatus = BusinessStatus.Zfb_reg_shifou_bangding_shouji,
            //    NextStatus = BusinessStatus.Zfb_reg_removeMobile0,
            //    CurrentUrl = "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-removeMobile-fullpage&scene_code=removeMobile",
            //    note = "选择解绑方式2-手机"
            //};
            //removeMobile0.OperationHandler += (s, e) => {
            //    MainCefFrame.LoadUrl("https://accounts.alipay.com/console/selectStrategy.htm?sp=1-removeMobile-fullpage&strategy=sms-payment_password");
            //};

            Operation removeMobile1 = new Operation(MainCefFrame)
            {
                index          = 3.2,
                PerviousStatus = BusinessStatus.Zfb_reg_removeMobile0,
                NextStatus     = BusinessStatus.Zfb_reg_removeMobile1,
                CurrentUrl     = "https://accounts.alipay.com/console/selectStrategy.htm?sp=1-removeMobile-fullpage&strategy=email-id_card_raw-payment_password",
                note           = "输入身份证信息和支付密码"
            };

            removeMobile1.OperationHandler += (s, e) => {
                Thread.Sleep(2000);
                CefFrameHelper.ExcuteJs(MainCefFrame, "document.getElementById('J-certNo').value='{0}';".With(currentHaoZi.zfbSFZ));

                new Thread(() => {
                    #region ---输入支付密码---
                    Thread.Sleep(1000);
                    MouseKeyBordHelper.POINT p1;
                    MouseKeyBordHelper.GetCursorPos(out p1);
                    LogManager.WriteLog("mouse position {0},{1}   ".With(p1.X, p1.Y));
                    LogManager.WriteLog("Form position {0},{1}   ".With(this.Left, this.Top));


                    //int chax = 582 - 110;
                    //int chay = 557 - 110;
                    int chax = ConfigHelper.GetIntValue("取消手机页面左边距");  // 600 - 61;
                    int chay = ConfigHelper.GetIntValue("取消手机页面上边距");  // 562 - 171;

                    Thread.Sleep(1000);
                    MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay);

                    Thread.Sleep(1000);
                    var s1 = currentHaoZi.zfbPayPwd;
                    LogManager.WriteLog(s1);
                    MouseKeyBordHelper.KeyBoardDo(s1.ToCharArray());
                    #endregion

                    //new Thread(() => {
                    //    Thread.Sleep(3000);
                    //CefFrameHelper.ExcuteJs(MainCefFrame,
                    //    "document.getElementById('J-selectStrategyForm').submit();");
                    LogManager.WriteLog("mouse {0},{1}   ".With(p1.X, p1.Y));
                    MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay + ConfigHelper.GetIntValue("取消手机页面待移动距离"));
                    //  }).Start();
                }).Start();
            };

            #region MyRegion
            //Operation removeMobile1 = new Operation(MainCefFrame) {
            //    index = 3.2,
            //    PerviousStatus = BusinessStatus.Zfb_reg_removeMobile0,
            //    NextStatus = BusinessStatus.Zfb_reg_removeMobile1,
            //    CurrentUrl = "https://accounts.alipay.com/console/selectStrategy.htm?sp=1-removeMobile-fullpage&strategy=email-id_card_raw-payment_password",
            //    note = "输入手机验证码和支付密码"
            //};
            //removeMobile1.OperationHandler += (s, e) => {
            //    #region MyRegion
            //    Thread.Sleep(2000);
            //    string js1 = "document.getElementsByClassName('ui-button-text')[0].click();";
            //    CefFrameHelper.ExcuteJs(MainCefFrame,
            //        js1);

            //    new Thread(() => {
            //        #region ---输入支付密码---
            //        Thread.Sleep(1000);
            //        MouseKeyBordHelper.POINT p1;
            //        MouseKeyBordHelper.GetCursorPos(out p1);
            //        LogManager.WriteLog("mouse position {0},{1}   ".With(p1.X, p1.Y));
            //        LogManager.WriteLog("Form position {0},{1}   ".With(this.Left, this.Top));

            //        int chax = 367;
            //        int chay = 403;
            //        Thread.Sleep(1000);
            //        MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay);

            //        Thread.Sleep(1000);
            //        var s1 = currentHaoZi.zfbPayPwd;
            //        LogManager.WriteLog(s1);
            //        MouseKeyBordHelper.KeyBoardDo(s1.ToCharArray());
            //        #endregion

            //        //收验证码
            //        LogManager.WriteLog("之前的号码是 {0} 继续获取".With(GlobalVar.phoneNum));

            //        string vcodeNum = "";
            //        bool isVcodeOk = SmsConfigHelper.GetSmsOfPhone(GlobalVar.phoneNum, ref vcodeNum, SmsServer.zfb_jiebang);

            //        string js2 = "document.getElementById('J-inputCode').value='{0}';".With(vcodeNum);
            //        CefFrameHelper.ExcuteJs(MainCefFrame, js2);


            //        //new Thread(() => {
            //        //    Thread.Sleep(3000);
            //        //CefFrameHelper.ExcuteJs(MainCefFrame,
            //        //    "document.getElementById('J-inputCode').click();");
            //        //    "document.getElementById('J-selectStrategyForm').submit();");
            //        LogManager.WriteLog("mouse {0},{1}   ".With(p1.X, p1.Y));
            //        MouseKeyBordHelper.MoveAndLeftClick(this.Left, this.Top, chax, chay + 65);
            //        //  }).Start();
            //    }).Start();
            //    #endregion
            //};
            #endregion

            Operation removeMobile2 = new Operation(MainCefFrame)
            {
                index          = 3.3,
                PerviousStatus = BusinessStatus.Zfb_reg_removeMobile1,
                NextStatus     = BusinessStatus.Zfb_reg_removeMobile2,
                CurrentUrl     = "https://accounts.alipay.com/console/common/email/sendSuccess.htm?emailType=securityCheckEmail&emailLogonId=",
                note           = "去邮件完成验证"
            };
            removeMobile2.OperationHandler += (s, e) => {
                //#3.3
                var url = EmailCheck("请完成邮箱验证", "立即解除手机绑定");
                if (!string.IsNullOrEmpty(url))
                {
                    MainCefFrame.LoadUrl(url);
                }
            };
            Operation removeMobile3 = new Operation(MainCefFrame)
            {
                index          = 3.4,
                PerviousStatus = BusinessStatus.Zfb_reg_removeMobile2,
                NextStatus     = BusinessStatus.Zfb_reg_removeMobile3,
                CurrentUrl     = "https://accounts.alipay.com/console/emailSecurityConfirm.htm?activeKey=",
                note           = "点击链接,继续解绑手机"
            };
            removeMobile3.OperationHandler += (s, e) => {
                var js = "window.location=window.frames[0].document.getElementsByClassName('linklist')[0].getElementsByTagName('a')[0].href;";
                CefFrameHelper.ExcuteJs(MainCefFrame, js);
            };
            Operation removeMobile4 = new Operation(MainCefFrame)
            {
                index          = 3.5,
                PerviousStatus = BusinessStatus.Zfb_reg_removeMobile3,
                NextStatus     = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion_before,
                CurrentUrl     = "https://accounts.alipay.com/console/common/success.htm?sp=1-removeMobile-fullpage&isCancelCard=false&sp=1-removeMobile-fullpage&site=1&scene_code=removeMobile&page_type=fullpage",
                note           = "解绑成功,继续添加密保"
            };
            removeMobile4.OperationHandler += (s, e) => {
                //  var    CurrentUrl = "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-addSecurityQuestion-fullpage&scene_code=addSecurityQuestion";

                BT_ZFB_REG_nav2addsq_Click(s, e);
                //state = BusinessStatus.zfb_reg_nav2set_add_SecurityQuestion_before;
                //MainCefFrame.LoadUrl(
                //    "https://accounts.alipay.com/console/queryStrategy.htm?site=1&page_type=fullpage&sp=1-addSecurityQuestion-fullpage&scene_code=addSecurityQuestion"

                //    );
                //CurrentUrl = "https://my.alipay.com/portal/account/index.htm",
            };
            //
            Operation taobaoopen = new Operation(MainCefFrame)
            {
                index          = 27,
                PerviousStatus = BusinessStatus.zfb_reg_open_tb_before,
                NextStatus     = BusinessStatus.zfb_reg_taobao_new_alipay_q,
                CurrentUrl     = "https://my.alipay.com/portal/account/index.htm",
                note           = "开通淘宝"
            };

            // BusinessStatus.zfb_reg_taobao_new_alipay_q;
            taobaoopen.OperationHandler += BT_ZFB_REG_TB_open_Click;

            //zfb注册 手机验证


            opsList.Add(nav2jiebang);
            opsList.Add(removeMobile0);
            opsList.Add(removeMobile1);
            opsList.Add(removeMobile2);
            opsList.Add(removeMobile3);
            opsList.Add(removeMobile4);

            //=================

            opsList.Add(zfb_reg_queryStrategy);
            opsList.Add(nav2set_SQ);
            opsList.Add(add_SQ);
            opsList.Add(setQa);
            opsList.Add(setQa_confirm);
            opsList.Add(add_sq_sucess);
            opsList.Add(taobaoopen);
            //
            //添加收货地址
        }