Exemplo n.º 1
0
 //获取验证码按钮
 private void SecurityCodeBtu_Click(object sender, EventArgs e)
 {
     if (MetarnetRegex.IsMobilePhone(this.PhoneNumberTXT.Text.Trim()))
     {
         DataSet ds =
             Database.RunDataSet("select * from Person where PersonPN='" +
                                 this.PhoneNumberTXT.Text.Trim() + "'");
         if (ds.Tables[0].Rows.Count != 0)
         {
             MessageBox.Show("此手机号已被注册!", "温馨提示", MessageBoxButtons.OK);
             return;
         }
         else
         {
             SendMessage send = new SendMessage();
             SecurityCodes = send.SendMessages(this.PhoneNumberTXT.Text.Trim());
             if (!string.IsNullOrEmpty(SecurityCodes))
             {
                 IsHaveSend = true;
                 MessageBox.Show("验证码已发送,请注意查收!", "温馨提示", MessageBoxButtons.OK);
                 this.SecurityCodeTXT.Focus();
             }
         }
     }
     else
     {
         MessageBox.Show("手机号格式不正确,请检查!", "温馨提示", MessageBoxButtons.OK);
     }
 }
Exemplo n.º 2
0
        private static int SecurityCode; //验证码


        //发送验证码
        private string SendSecurityCode(string SecurityCode, string phoneNumber)
        {
            string result = "";

            if (MetarnetRegex.IsMobilePhone(phoneNumber))
            {
                ITopClient client = new DefaultTopClient(url, AppKey, Security);

                AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();

                req.Extend = "123456";

                req.SmsType = "normal";

                req.SmsFreeSignName = "注册验证";
                //    req.SmsParam = String.Format("{\"code\":\"1234\",\"product\":\"打堆云打印\"}", SecurityCode);// "{\"code\":\"1234\",\"product\":\"打堆云打印\"}";
                req.SmsParam        = "{\"code\":\"" + SecurityCode + "\",\"product\":\"宋刚之云商行\"}";
                req.RecNum          = phoneNumber;
                req.SmsTemplateCode = "SMS_3125049";
                AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req);
                result = rsp.Body;
            }
            return(result);
        }