Esempio n. 1
0
        public override SMSResult AddIgnoreList()
        {
            SMSResult resp = new SMSResult();
            string result = "";

            try
            {
                result = send.HttpPost(url,
                        "action=addIgnoreList&uid=" + user + "&token=" + token
                                + "&mobiles=" + mobilenum + "&pid=" + projID);

                if (isNumber(result))
                {
                    resp.Status = true;
                   // resp.Row = int.Parse(result);
                    resp.Result = result;

                }
                else
                {
                    resp.Status = false;
                    resp.Result = result;
                }

            }
            catch (Exception e)
            {
                resp.Result = e.Message;
                resp.Status = false;
            }
            return resp;
        }
Esempio n. 2
0
        public override SMSResult GetMessage()
        {
            SMSResult resp = new SMSResult();
            String result = "";
            try
            {
            //                 result = send.HttpPost(url,
            //                         "action=getVcodeAndReleaseMobile&uid=" + user + "&token="
            //                                 + token + "&mobile=" + mobilenum + "&author_uid="
            //                                 + author_uid);

                result = send.HttpPost(url,
                        "action=getVcodeAndReleaseMobile&uid=" + user + "&token="
                                + token + "&mobile=" + mobilenum + "&author_uid=msguser");

                String[] reset = result.Split('|');
                if (reset.Length >= 2 && isNumber(reset[0]))
                {
                    resp.Status = true;
                    //resp.Mobile = reset[0];
                    resp.Result = reset[1];
                 //   resp.Result = result;

                }
                else
                {
                    resp.Status = false;
                    resp.Result = result;
                }

            }
            catch (Exception e)
            {
                resp.Result = e.Message;
                resp.Status = false;
            }
            return resp;
        }
Esempio n. 3
0
 public override SMSResult GetMessageAndRealase()
 {
     SMSResult result = new SMSResult();
     string postdata = "action=getVcodeAndReleaseMobile&mobile=" + mobilenum + "&token=" + token + "&uid=" + user;
     string html = getHTML(url, postdata);
     if (checkMsg(ref html) == true)
     {
         result.Status = true;
         result.Result = html.Substring(html.LastIndexOf("|") + 1);
     }
     else
     {
         result.Status = false;
         result.Result = html;
     }
     return result;
 }
Esempio n. 4
0
        public override SMSResult ReleasePhoneNum(string phoneNum)
        {
            SMSResult resp = new SMSResult();
            String result = "";
            try
            {
                result = send.HttpPost(url,
                        "action=cancelSMSRecv&uid=" + user + "&token=" + token
                                + "&mobile=" + phoneNum);

                if ("1".Equals(result))
                {
                    resp.Status = true;
                    //resp.Flag = result;
                    resp.Result = result;
                }
                else
                {
                    resp.Status = false;
                   // resp.Flag = result;
                    resp.Result = result;
                }

            }
            catch (Exception e)
            {
                resp.Result = e.Message;
                resp.Status = false;
            }
            return resp;
        }
Esempio n. 5
0
        public override SMSResult ReleaseAll()
        {
            SMSResult resp = new SMSResult();
            String result = "";

            try
            {
                result = send.HttpPost(url,
                        "action=cancelSMSRecvAll&uid=" + user + "&token=" + token);

                if ("1".Equals(result))
                {
                    resp.Status = true;
                    resp.Result = result;
                }
                else
                {
                    resp.Status = false;
                    resp.Result = result;
                }

            }
            catch (Exception e)
            {
                resp.Result = e.Message;
                resp.Status = false;
            }
            return resp;
        }
Esempio n. 6
0
 public override SMSResult AddIgnoreList()
 {
     SMSResult rnt = new SMSResult() { Status = false };
     if (logined)
     {
         string result = DoPost(string.Format("event_name_addBlacklist={0}&action=phone%3APhoneEventAction&serviceId={1}&phone={2}", "%E5%8F%96%E6%89%8B%E6%9C%BA%E5%8F%B7", projID, mobilenum));
         if (result.Contains("true"))
         {
             rnt.Result = result;
             rnt.Status = true;
         }
         else
         {
             rnt.Result = result;
             rnt.Status = false;
         }
     }
     else
     {
         rnt.Result = "请先登录";
     }
     return rnt;
 }
Esempio n. 7
0
        private bool InputPhone(Object sender, Object param)
        {
            try
               {

               if (this.InvokeRequired)
               {
                   this.Invoke(new AccessHandler(InputPhone), sender, param);
               }
               else
               {
                   try
                   {
                       callingOnce = true;
                       IWebElement titleElement = driver.FindElement(By.XPath(RegisterXpath.CURRENT_TITLE_XPATH));

                       if (!titleElement.Text.Trim().Equals(RegisterXpath.TITLE_IDENTITY_VERIFY))
                       {
                           OutMsg("图片验证码错误...");
                           CUR_LOOP_CNT = 0;
                           beginToClickClearBtn = true;
                           processControlor.GotoHanlderUnit("FillUserName", 1000);
                           return false;
                       }

                       if (!SMSProxy.IsLogined())
                       {
                           OutMsg("等待短信验证码登录...");
                           callingOnce = false;
                           return false;
                       }
                       OutMsg("短信验证码登录成功");
                       // SMSProxy.GetSmsInstance().ReleaseAll();
                       if (!SMSProxy.GetSmsInstance().IsLogined())
                       {
                           callingOnce = false;
                           return false;
                       }

                       if (IsTheFirstTime)
                       {
                           IsTheFirstTime = false;
                           isFinished = false;
                           Thread th = new Thread(new ThreadStart(delegate()
                           {
                               smsRlt = SMSProxy.GetSmsInstance().GetPhoneNum();
                               OutMsg(smsRlt.Result);
                               isFinished = true;
                           }));
                           th.Start();
                       }

                       if (isFinished == false)
                       {
                           OutMsg("等待获取电话号码....");
                           if (++repeatTimes >= 10)
                           {
                               repeatTimes = 0;
                               IsTheFirstTime = true;
                               OutMsg("重新登录,释放所有号码,重新获取手机号码");
                               Thread th = new Thread(new ThreadStart(delegate()
                               {
                                   SMSProxy.GetSmsInstance().Login();
                                   SMSProxy.GetSmsInstance().ReleaseAll();
                               }));
                               th.Start();
                           }
                           processControlor.ResetRepeatTimes();
                           callingOnce = false;
                           return false;
                       }

                       if (smsRlt.Status == false)
                       {
                           OutMsg(smsRlt.Result);
                           callingOnce = false;
                           IsTheFirstTime = true;
                           return false;
                       }
                       curEntity.phoneNum = smsRlt.Result;
                       IWebElement phoneCodeElement = driver.FindElement(By.XPath(RegisterXpath.PHONE_NUM_INPUT));
                       InputKeys(phoneCodeElement, curEntity.phoneNum);

                   }
                   catch (System.Exception ex)
                   {
                       OutMsg(ex.Message);
                       processControlor.GotoHanlderUnit("CloseDriver", 1000);
                   }

               }
               }
               catch (System.ObjectDisposedException ex)
               {

               }

               return callingOnce;
        }
Esempio n. 8
0
 public override SMSResult Login()
 {
     SMSResult result = new SMSResult();
     result.OpType = SMSType.LOGIN;
     string postdata = "action=loginIn&uid=" + user + "&pwd=" + passwd;
     string html = getHTML(url, postdata);
     if (checkMsg(ref html) == true)
     {
         token = html.Substring(html.IndexOf("|") + 1);
         result.Status = true;
         result.Result = token;
     }
     else
     {
         result.Status = false;
         result.Result = html;
     }
     return result;
 }
Esempio n. 9
0
        public override SMSResult AddIgnoreList()
        {
            SMSResult resp = new SMSResult();
            String result = "";

            try
            {
                result = send.HttpPost(url,
                        "action=addBlacklist&uid=" + user + "&token=" + token
                                + "&phone=" + mobilenum + "&sid=" + projID);
                if (isNumber(result))
                {
                    resp.Status = true;
                    resp.Result = result;

                }
                else
                {
                    resp.Status = false;
                    resp.Result = result;
                }

            }
            catch (Exception e)
            {
                resp.Status = false;
            }
            return resp;
        }
Esempio n. 10
0
 public override SMSResult ReleasePhoneNum(string phoneNum)
 {
     SMSResult rnt = new SMSResult() { Status = false };
     if (logined)
     {
         var result = DoPost(string.Format("event_name_cancelRecv={0}&action=phone%3APhoneEventAction&serviceId={1}&phone={2}", "%E5%8F%96%E6%89%8B%E6%9C%BA%E5%8F%B7", projID, mobilenum));
         if (result.Contains("true"))
         {
             rnt.Result = result;
             rnt.Status = true;
         }
     }
     else
     {
         rnt.Result = "请先登录";
     }
     return rnt;
 }
Esempio n. 11
0
 public override SMSResult ReleaseAll()
 {
     SMSResult rnt = new SMSResult() { Status = false };
     if (logined)
     {
         string result = DoPost(string.Format("event_name_cancelAllRecv={0}&action=phone%3APhoneEventAction", "%E5%8F%96%E6%89%8B%E6%9C%BA%E5%8F%B7"));
         if (result.Contains("true"))
         {
             rnt.Result = result;
             rnt.Status = true;
         }
         else
         {
             rnt.Result = result;
             rnt.Status = false;
         }
     }
     else
     {
         rnt.Result = "请先登录";
     }
     return rnt;
 }
Esempio n. 12
0
        public override SMSResult Login()
        {
            SMSResult rnt = new SMSResult();

            string result = DoPost(string.Format("action={2}&event_name_login={3}&uid={0}&password={1}", user, MD5Encrypt(passwd).ToUpper(), "user%3aUserEventAction", "%E5%8F%96%E6%89%8B%E6%9C%BA%E5%8F%B7"));
            if (result.Contains("登录成功"))
            {
                logined = true;
                rnt.Status = true;
                rnt.Result = "登录成功";
            }
            loginCookies = cookies;
            return rnt;
        }
Esempio n. 13
0
 public override SMSResult GetPhoneNum()
 {
     SMSResult rnt = new SMSResult();
     rnt.Status = false;
     if (logined)
     {
         string result = DoPost(string.Format("event_name_getPhone=%E5%8F%96%E6%89%8B%E6%9C%BA%E5%8F%B7&action=phone%3APhoneEventAction&serviceId={0}", projID));
         if (result.Contains("true"))
         {
             string m = Regex.Match(result, @"(\d{11})", RegexOptions.Multiline).Groups[1].Value;
             if (!string.IsNullOrEmpty(m))
             {
                 rnt.Result = m;
                 rnt.Status = true;
                 mobilenum = m;
             }
             else
             {
                 rnt.Status = false;
                 rnt.Result = "未获取到号码";
             }
         }
     }
     else
     {
         rnt.Result = "请先登录";
     }
     return rnt;
 }
Esempio n. 14
0
        public override SMSResult GetMessageAndRealase()
        {
            SMSResult resp = new SMSResult();
            String result = "";
            try
            {
                result = send.HttpPost(url,
                        "action=getVcodeAndHoldMobilenum&uid=" + user + "&token="
                                + token + "&mobile=" + mobilenum + "&next_pid="
                                + projID);

                // 返回值:发送号码|验证码|下次获取验证码的token(暂时无用)
                String[] reset = result.Split('|');
                if (reset.Length >= 2 && isNumber(reset[0]))
                {
                    resp.Status = true;
                    resp.Result = reset[1];

                }
                else
                {
                    resp.Status = false;
                    resp.Result = result;
                }

            }
            catch (Exception e)
            {
                resp.Result = e.Message;
                resp.Status = false;
            }
            return resp;
        }
Esempio n. 15
0
 public override SMSResult GetMessage()
 {
     SMSResult rnt = new SMSResult() { Status =false };
     if (logined)
     {
         string result = DoPost(string.Format("event_name_getMessage=%E5%8F%96%E7%9F%AD%E4%BF%A1&action=phone%3APhoneEventAction&serviceId={0}&phone={1}", projID, mobilenum));
         if (result.Contains("true"))
         {
             string m = result.Split(new string[] { "message" }, StringSplitOptions.None)[1].Replace('"', ' ').Trim();
             rnt.Result = m;
             rnt.Status = true;
         }
         else
         {
             rnt.Result = "尚未收到验证码";
             rnt.Status = false;
         }
     }
     else
     {
         rnt.Result = "请先登录";
     }
     return rnt;
 }
Esempio n. 16
0
 public override SMSResult GetMessage()
 {
     SMSResult result = new SMSResult();
     result.OpType = SMSType.CHECKCODE;
     string postdata = "action=getMessage&sid=" + projID + "&phone=" + mobilenum + "&token=" + token + "&uid=" + user
         + "&author=msguser";
     string html = getHTML(url, postdata);
     if (checkMsg(ref html) == true)
     {
         result.Status = true;
         result.Result = html.Substring(html.LastIndexOf("|") + 1);
     }
     else
     {
         result.Status = false;
         result.Result = html;
     }
     return result;
 }
Esempio n. 17
0
        public override SMSResult GetPhoneNum()
        {
            SMSResult result = new SMSResult();
            result.OpType = SMSType.PHONENUM;
            string postdata = "action=getMobilenum&pid=" + projID + "&uid=" + user + "&token=" + token;
            string html = getHTML(url, postdata);
            string token1;
            if (checkMsg(ref html) == true)
            {
                mobilenum = html.Substring(0, html.IndexOf("|"));
                token1 = html.Substring(html.IndexOf("|") + 1);

                result.Status = true;
                result.Result = mobilenum;
            }
            else
            {
                result.Status = false;
                result.Result = html;
            }
            return result;
        }
Esempio n. 18
0
        public override SMSResult ReleaseAll()
        {
            SMSResult resp = new SMSResult();
            String result = "";

            try
            {
                string postdata = "action=cancelAllRecv&token=" + token;
                result = send.HttpPost(url, postdata);
                if (isNumber(result))
                {
                    resp.Status = true;
                    resp.Result = result;

                }
                else
                {
                    resp.Status = false;
                    resp.Result = result;
                }

            }
            catch (Exception e)
            {
                resp.Status = false;
            }
            return resp;
        }
Esempio n. 19
0
        public override SMSResult ReleasePhoneNum(string phoneNum)
        {
            SMSResult resp = new SMSResult();
            String result = "";

            try
            {
                string postdata = "action=cancelSMSRecv&mobile=" + phoneNum + "&token=" + token + "&uid=" + user;
                result = send.HttpPost(url,postdata);
                if (isNumber(result))
                {
                    resp.Status = true;
                    resp.Result = result;

                }
                else
                {
                    resp.Status = false;
                    resp.Result = result;
                }

            }
            catch (Exception e)
            {
                resp.Status = false;
            }
            return resp;
        }
Esempio n. 20
0
        public override SMSResult GetPhoneNum()
        {
            SMSResult resp = new SMSResult();
            String result = "";
            try
            {
                result = send.HttpPost(url, "action=getMobilenum&uid="
                        + user + "&token=" + token + "&pid=" + projID);

                String[] reset = result.Split('|');

                Regex regex = new Regex("\\d");
                if (reset.Length >= 2 && regex.Match(reset[0]).Success)
                {

                    resp.Status = true;
                    resp.Result = reset[0];
                    mobilenum = resp.Result;

                }
                else
                {
                    resp.Status = false;
                    resp.Result = result;
                }

            }
            catch (Exception e)
            {
                resp.Result = "获取一个手机号,账号:" + user + ",token:" + token
                + ",pid:" + projID + ",e=" + e.ToString();
                resp.Status = false;
            }
            return resp;
        }
Esempio n. 21
0
        /// <summary>
        /// 释放当前电话号码
        /// </summary>
        /// <returns></returns>
        public int ReleaseMobile()
        {
            SMSResult result = new SMSResult() { Status = false };
            rtnList.Add(result);
            bFinishedList.Add(false);
            AsynHandler handler = new AsynHandler(smsInstance.ReleasePhoneNum);

            CallbackObject obj = new CallbackObject() { onHander = handler, mIndex = index };
            IAsyncResult ar = handler.BeginInvoke(AsyncCompleted, obj);
            return index++;
        }
Esempio n. 22
0
        public override SMSResult Login()
        {
            SMSResult smsRnt = new SMSResult();
            string result = "";
            try
            {
                result = send.HttpPost(url, "action=loginIn&uid=" + user + "&pwd=" + passwd);
                smsRnt.Result = result;
                String[] reset = result.Split('|');

                if (reset.Length >= 2 && user.Equals(reset[0]))
                {

                    smsRnt.Status = true;
                  //  resp.Uid = reset[0];
                    token = reset[1];
                  //  resp.Token = reset[1];
                }
                else
                {
                    smsRnt.Status = false;
                    smsRnt.Result = result;
                }
            }
            catch (Exception e)
            {
                smsRnt.Status = false;
            }
            return smsRnt;
        }
Esempio n. 23
0
        private bool CheckPhoneCodePage(Object sender, Object param)
        {
            try
            {

                if (this.InvokeRequired)
                {
                    this.Invoke(new AccessHandler(CheckPhoneCodePage), sender, param);
                }
                else
                {
                    try
                    {
                        callingOnce = true;
                        IWebElement codeCheckIcon = driver.FindElement(By.XPath(RegisterXpath.CURRENT_TITLE_LABEL));
                        string title = codeCheckIcon.Text;
                        OutMsg(title);
                        if (!title.Trim().Equals(RegisterXpath.FILL_CHECK_TITLE_TEXT))
                        {
                            OutMsg("手机号码可不使用...,重新换手机号码");
                            if (IsTheFirstTime)
                            {
                                isFinished = false;
                                Thread th = new Thread(new ThreadStart(delegate()
                                {
                                    smsRlt = SMSProxy.GetSmsInstance().AddIgnoreList();
                                    isFinished = true;
                                }));
                                IsTheFirstTime = true;
                                th.Start();
                            }
                            beginToClickClearBtn = true;
                            processControlor.GotoHanlderUnit("InputPhone", 1000);
                        }
                        RegisterXpath.curphoneLoopTimes = 0;
                    }
                    catch (System.Exception ex)
                    {
                        OutMsg(ex.Message);
                        processControlor.GotoHanlderUnit("CloseDriver", 1000);
                    }

                }
            }
            catch (System.ObjectDisposedException ex)
            {

            }
            return true;
        }
Esempio n. 24
0
 private static void BeginLogin()
 {
     if (smsInstance == null)
      {
          GetSmsInstance();
      }
     result = smsInstance.Login();
 }