Exemple #1
0
        public ActionResult GetPassWord_Mobile()
        {
            if (!VerifyHelper.Check(Request.Form["VCode_hid"]))
            {
                function.WriteErrMsg("验证码不正确", "/User/Change/GetPassword"); return(Content(""));
            }
            M_UserInfo mu     = GetUserByName(Request.Form["TxtUserName"]);
            M_Uinfo    basemu = buser.GetUserBaseByuserid(mu.UserID);

            if (string.IsNullOrEmpty(basemu.Mobile))
            {
                function.WriteErrMsg("用户未设置手机号,无法通过手机号找回"); return(Content(""));
            }
            string code    = function.GetRandomString(6, 2);
            string content = "你正在使用找回密码服务,校验码:" + code;
            string mobile  = basemu.Mobile;

            if (mobileBll.CheckMobile(mobile))
            {
                string ret = SendWebSMS.SendMessage(mobile, content);
                //添加一条发送手机短信记录
                mobileBll.Insert(new M_Safe_Mobile()
                {
                    Phone = mobile, VCode = code, Source = "GetPassWord_Mobile", UserID = mu.UserID, UserName = mu.UserName, SysRemind = ret
                });
            }
            else
            {
                function.WriteErrMsg("短信发送次数超过上限!"); return(null);
            }
            UserMobile  = mobile;
            GetPwdUName = mu.UserName;
            GetPwdStep  = "mobile_code";
            return(View("GetPassWord"));
        }
Exemple #2
0
        public ActionResult GetPassWord_Mobile()
        {
            if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], Request.Form["VCode"]))
            {
                function.WriteErrMsg("验证码不正确", "/User/Change/GetPassword"); return(Content(""));
            }
            M_UserInfo mu     = GetUserByName(Request.Form["TxtUserName"]);
            M_Uinfo    basemu = buser.GetUserBaseByuserid(mu.UserID);

            if (string.IsNullOrEmpty(basemu.Mobile))
            {
                function.WriteErrMsg("用户未设置手机号,无法通过手机号找回"); return(Content(""));
            }
            string code    = function.GetRandomString(6, 2);
            string content = "【" + SiteConfig.SiteInfo.SiteName + "】,你正在使用找回密码服务,校验码:" + code;

            SendWebSMS.SendMessage(basemu.Mobile, content);
            //短信信息存入数据库
            M_Message messInfo = new M_Message();

            messInfo.Title    = "验证码:找回密码";
            messInfo.PostDate = DataConverter.CDate(DateTime.Now.ToLocalTime().ToString());
            messInfo.Content  = content;
            messInfo.Receipt  = "";
            messInfo.MsgType  = 3;
            messInfo.status   = 1;
            messInfo.Incept   = mu.UserID.ToString();
            B_Message.Add(messInfo);

            mu.seturl = code;
            buser.UpdateByID(mu);
            GetPwdStep = "mobile_code";
            return(View("GetPassWord"));
        }
Exemple #3
0
 public override CommonReturn Send(string[] mobiles, SMS_Packet packet)
 {
     foreach (string mobile in mobiles)
     {
         if (string.IsNullOrEmpty(mobile))
         {
             continue;
         }
         SendWebSMS.SendMessage(mobile, packet.message);
     }
     return(CommonReturn.Success());
 }
Exemple #4
0
        //发送手机验证码(步骤1或步骤2的)
        public string SendValidCode(string key, string vcode, string mobile)
        {
            if (!B_User.CheckIsLogged(Request.RawUrl))
            {
                return(null);
            }
            B_Safe_Mobile mbBll = new B_Safe_Mobile();

            basemu   = buser.GetUserBaseByuserid(buser.GetLogin().UserID);
            CheckNum = ""; NewCheckNum = "";
            switch (Step)
            {
            case 2:
                NewCheckNum   = function.GetRandomString(6, 2).ToLower();
                basemu.Mobile = mobile;
                break;

            default:
                CheckNum = function.GetRandomString(6, 2).ToLower();
                break;
            }
            if (!ZoomlaSecurityCenter.VCodeCheck(key, vcode))
            {
                retMod.retmsg = "验证码不正确";
            }
            else
            {
                if (mbBll.CheckMobile(basemu.Mobile))
                {
                    string content = "【" + SiteConfig.SiteInfo.SiteName + "】你正在使用修改手机号服务,校验码:" + CheckNum + NewCheckNum;
                    SendWebSMS.SendMessage(basemu.Mobile, content);
                    M_Message messInfo = new M_Message();
                    messInfo.Sender  = basemu.UserId.ToString();
                    messInfo.Title   = "验证码:修改手机号[" + basemu.Mobile + "]";
                    messInfo.Content = content;
                    messInfo.Receipt = "";
                    messInfo.MsgType = 2;
                    messInfo.status  = 1;
                    messInfo.Incept  = basemu.UserId.ToString();
                    B_Message.Add(messInfo);
                    retMod.retcode = M_APIResult.Success;
                    retMod.retmsg  = "校验码已成功发送到你的手机";
                }
                else
                {
                    retMod.retmsg = "禁止向该号码发送短信,请联系管理员";
                }
            }
            return(retMod.ToString());
        }
Exemple #5
0
    //发送校验号
    protected void SendEMail_Btn_Click(object sender, EventArgs e)
    {
        M_Uinfo basemu = buser.GetUserBaseByuserid(buser.GetLogin().UserID);

        CheckNum = function.GetRandomString(6, 2).ToLower();
        //CheckNum = "111111";
        if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], VCode.Text))
        {
            ShowAlert("验证码不正确"); return;
        }
        else
        {
            SendWebSMS.SendMessage(basemu.Mobile, "【" + SiteConfig.SiteInfo.SiteName + "】你正在使用修改手机号服务,校验码:" + CheckNum);
            ShowInfo("校验码已成功发送到你的手机");
        }
    }
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (this.t_sendNo.Text != null && this.t_sendNo.Text.Trim() != "" && this.s_memo.Text.Trim() != "" && this.s_memo.Text != null)
     {
         SendWebSMS.SendMessage(this.t_sendNo.Text.Trim(), this.s_memo.Text.Trim());
         M_Message messInfo = new M_Message();
         messInfo.Sender   = badmin.GetAdminLogin().AdminId.ToString();
         messInfo.Title    = "手机信息";
         messInfo.PostDate = DataConverter.CDate(DateTime.Now.ToLocalTime().ToString());
         messInfo.Content  = s_memo.Text;
         messInfo.Receipt  = "";
         messInfo.MsgType  = 2;
         messInfo.status   = 1;
         B_Message.Add(messInfo);
         function.WriteSuccessMsg("发送成功!");
     }
 }
Exemple #7
0
    //-----------------Step2
    protected void SendNewEmail_Btn_Click(object sender, EventArgs e)
    {
        M_Uinfo basemu = buser.GetUserBaseByuserid(buser.GetLogin().UserID);

        NewMobile = NewMobile_T.Text.Trim();
        //if (buser.IsExist("ume", NewMobile)) { ShowAlert("该手机号已存在"); return; }
        NewCheckNum = function.GetRandomString(6, 2).ToLower();
        //NewCheckNum = "111111";
        if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["NewVCode_hid"], NewVCode.Text))
        {
            ShowAlert("验证码不正确" + Request.Form["NewVCode_hid"] + ":" + NewVCode.Text); return;
        }
        else
        {
            SendWebSMS.SendMessage(NewMobile_T.Text, "【" + SiteConfig.SiteInfo.SiteName + "】校验码:" + NewCheckNum);
            ShowInfo("校验码已成功发送到你的新手机!");
        }
    }
Exemple #8
0
    /// <summary>
    /// 付款成功后,发送管理员短信,邮件,顾客短信
    /// </summary>
    /// <cmd>详见OrderMsg_Chk等参数,payed,ordered</cmd>
    /// <returns>发送结果</returns>
    public string SendMessage(M_OrderList orderMod, M_Order_PayLog logMod, string cmd)
    {
        if (logMod == null)
        {
            logMod = new M_Order_PayLog();
        }
        DataTable orderDT = orderBll.GetOrderListByUid(orderMod.id);
        string    msg = "", result = "", tlp = "";

        if (!SiteConfig.SiteOption.OrderMsg_Chk.Contains(cmd))
        {
            result = cmd + "顾客短信ERR:未开启短信通知";
        }
        else if (!RegexHelper.IsMobilPhone(orderMod.MobileNum))
        {
            result = cmd + "顾客短信ERR:(" + orderMod.MobileNum + ")手机号码不正确";
        }
        else
        {
            tlp = GetJsonVal(SiteConfig.SiteOption.OrderMsg_Tlp, cmd);
            if (string.IsNullOrEmpty(tlp))
            {
                result = cmd + "顾客短信ERR:模板为空";
            }
            else
            {
                msg    = TlpDeal(tlp, orderDT);
                result = cmd + "顾客短信Info:(" + orderMod.MobileNum + ")" + SendWebSMS.SendMessage(orderMod.MobileNum, msg);
                //ZLLog.L(result+"|||"+msg);
            }
        }
        logMod.Remind += result + ",";
        /*---------------------------------------------------------*/
        if (!SiteConfig.SiteOption.OrderMasterMsg_Chk.Contains(cmd))
        {
            result = cmd + "管理员短信ERR:未开启短信通知";
        }
        else if (!RegexHelper.IsMobilPhone(SiteConfig.SiteInfo.MasterPhone))
        {
            result = cmd + "管理员短信ERR:" + SiteConfig.SiteInfo.MasterPhone + "手机号码不正确";
        }
        else
        {
            tlp = GetJsonVal(SiteConfig.SiteOption.OrderMasterMsg_Tlp, cmd);
            if (string.IsNullOrEmpty(tlp))
            {
                result = cmd + "管理员短信ERR:模板为空";
            }
            else
            {
                msg    = TlpDeal(tlp, orderDT);
                result = cmd + "管理员短信Info:(" + SiteConfig.SiteInfo.MasterPhone + ")" + SendWebSMS.SendMessage(SiteConfig.SiteInfo.MasterPhone, msg);
            }
        }
        logMod.Remind += result + ",";
        /*---------------------------------------------------------*/
        if (!SiteConfig.SiteOption.OrderMasterEmail_Chk.Contains(cmd))
        {
            result = cmd + "管理员邮件ERR:未开启邮件通知";
        }
        else if (!RegexHelper.IsEmail(SiteConfig.SiteInfo.WebmasterEmail))
        {
            result = cmd + "管理员邮件ERR:" + SiteConfig.SiteInfo.WebmasterEmail + "邮件地址不正确";
        }
        else
        {
            tlp = GetJsonVal(SiteConfig.SiteOption.OrderMasterMsg_Tlp, cmd);
            if (string.IsNullOrEmpty(tlp))
            {
                result = cmd + "管理员邮件ERR:模板为空";
            }
            else
            {
                msg = TlpDeal(tlp, orderDT);
                MailAddress adMod    = new MailAddress(SiteConfig.SiteInfo.WebmasterEmail);
                MailInfo    mailInfo = new MailInfo()
                {
                    ToAddress = adMod, IsBodyHtml = true
                };
                mailInfo.FromName = SiteConfig.SiteInfo.SiteName;
                mailInfo.Subject  = SiteConfig.SiteInfo.SiteName + "订单付款提醒";
                mailInfo.MailBody = msg;
                result            = "管理员邮件Info:(" + SiteConfig.SiteInfo.WebmasterEmail + ")" + SendMail.Send(mailInfo).ToString();
            }
        }
        logMod.Remind += result + ",";
        return(logMod.Remind);
    }
        ///// <summary>
        ///// 获取余额接口
        ///// </summary>
        ///// <param name="uid"></param>
        ///// <param name="pwd"></param>
        ///// <returns></returns>
        //private string GetBalance(string uid, string pwd)
        //{
        //    string Send_URL = "http://service.winic.org/webservice/public/remoney.asp?uid=" + uid + "&pwd=" + pwd + "";
        //    MSXML2.XMLHTTP xmlhttp = new MSXML2.XMLHTTP();
        //    xmlhttp.open("GET", Send_URL, false, null, null);
        //    xmlhttp.send("");
        //    MSXML2.XMLDocument dom = new XMLDocument();
        //    Byte[] b = (Byte[])xmlhttp.responseBody;
        //    //string Flag = System.Text.ASCIIEncoding.UTF8.GetString(b, 0, b.Length);
        //    string andy = System.Text.Encoding.GetEncoding("GB2312").GetString(b).Trim();
        //    return andy;
        //}
        ///// <summary>
        ///// 发送短信调用接口
        ///// </summary>
        ///// <param name="uid"></param>
        ///// <param name="pwd"></param>
        ///// <param name="mob"></param>
        ///// <param name="msg"></param>
        ///// <returns></returns>
        //private string SendMsg(string uid, string pwd, string mob, string msg)
        //{
        //    string Send_URL = "http://service.winic.org/sys_port/gateway/?id=" + uid + "&pwd=" + pwd + "&to=" + mob + "&content=" + msg + "&time=";
        //    MSXML2.XMLHTTP xmlhttp = new MSXML2.XMLHTTP();
        //    xmlhttp.open("GET", Send_URL, false, null, null);
        //    xmlhttp.send("");
        //    MSXML2.XMLDocument dom = new XMLDocument();
        //    Byte[] b = (Byte[])xmlhttp.responseBody;
        //    //string Flag = System.Text.ASCIIEncoding.UTF8.GetString(b, 0, b.Length);
        //    string andy = System.Text.Encoding.GetEncoding("GB2312").GetString(b).Trim();
        //    return andy;
        //}
        protected void BtnSend_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string msg = Content_T.Text.Trim();
                if (string.IsNullOrEmpty(msg))
                {
                    function.WriteErrMsg("短信内容不能为空");
                }
                if (DataSecurity.Len(msg) > 70)
                {
                    function.WriteErrMsg("短信内容不能超过70个字");
                }
                string[] UserIds = InceptUser_Hid.Value.Trim(',').Split(',');
                if (UserIds.Length <= 0)
                {
                    function.WriteErrMsg("请选择用户");
                }
                if (UserIds.Length > 100)
                {
                    function.WriteErrMsg("每次最多只能发送100条短信!");
                }
                string mobs = "", ids = "";
                //获取用户信息中的手机号
                foreach (string uid in UserIds)
                {
                    M_Uinfo mu = buser.GetUserBaseByuserid(DataConverter.CLng(uid));
                    if (mu.IsNull)
                    {
                        continue;
                    }
                    if (!string.IsNullOrEmpty(mu.Mobile))
                    {
                        mobs += mu.Mobile + ",";
                        ids  += mu.UserId + ",";
                    }
                }
                mobs = mobs.Trim(',');
                ids  = ids.Trim(',');
                if (string.IsNullOrEmpty(ids))
                {
                    function.WriteErrMsg("没有要发送的号码");
                }
                string   req  = SendWebSMS.SendMessage(mobs, msg);
                string[] reqs = req.Split(new char[] { '/' });
                string   res  = "发送成功";
                switch (reqs[0])
                {
                case "-01":
                    res = "当前账号余额不足!";
                    break;

                case "-02":
                    res = "当前用户ID错误!";
                    break;

                case "-03":
                    res = "当前密码错误!";
                    break;

                case "-04":
                    res = "参数不够或参数内容的类型错误!";
                    break;

                case "-05":
                    res = "手机号码格式不对!";
                    break;

                case "-06":
                    res = "短信内容编码不对!";
                    break;

                case "-07":
                    res = "短信内容含有敏感字符!";
                    break;

                case "-8":
                    res = "无接收数据";
                    break;

                case "-09":
                    res = "系统维护中..";
                    break;

                case "-10":
                    res = "手机号码数量超长!(100个/次 超100个请自行做循环)";
                    break;

                case "-11":
                    res = "短信内容超长!(70个字符)";
                    break;

                case "-12":
                    res = "其它错误!";
                    break;
                }
                M_Message messInfo = new M_Message();
                messInfo.Sender   = badmin.GetAdminLogin().AdminId.ToString();
                messInfo.Title    = "手机信息";
                messInfo.PostDate = DataConverter.CDate(DateTime.Now.ToLocalTime().ToString());
                messInfo.Content  = Content_T.Text;
                messInfo.Receipt  = "";
                messInfo.MsgType  = 2;
                messInfo.status   = 1;
                messInfo.Incept   = ids;
                B_Message.Add(messInfo);
                if (res.Equals("发送成功"))
                {
                    function.WriteSuccessMsg(res, "Message.aspx");
                }
                else
                {
                    function.WriteErrMsg(res);
                }
            }
        }