예제 #1
0
        public string ajaxSend(string phone)
        {
            var randomCode         = new Random().Next(100000).ToString("D6");
            CheckMobileModel model = new CheckMobileModel()
            {
                Phone   = phone,
                Message = string.Format(SmsConfig.Instance.RgistetSmsText, randomCode)
            };

            YG.SC.Common.SendMessageHelper smsHelper = new Common.SendMessageHelper();
            try
            {
                string smsResult = smsHelper.SendMessage(phone, model.Message);
                YG.SC.OpenShop.PCnCache.Instance.Add(model.Phone, randomCode);
                // 更新短信通道

                SmsLog smsModel = new SmsLog()
                {
                    PhoneNumber = model.Phone,
                    SendStatus  = smsResult
                    ,
                    Content = model.Message
                };
                _iCustomerService.SendSmsSaveLog(smsModel);
                return
                    ("ok");
            }
            catch (Exception ex)
            {
                return("-1");
            }
        }
예제 #2
0
        public string ajaxSend(string phone)
        {
            var randomCode         = new Random().Next(100000).ToString("D6");
            CheckMobileModel model = new CheckMobileModel()
            {
                Phone   = phone,
                Message = string.Format(SmsConfig.Instance.RgistetSmsText, randomCode)
            };

            YG.SC.Common.SendMessageHelper smsHelper = new Common.SendMessageHelper();
            //if (!CommonValidator.IsValidPhoneNumber(PhoneNo))
            //{
            //    return SimpleResultModel.Conclude(SendCheckCodeStatus.手机号码无效);
            //}
            try
            {
                string smsResult = smsHelper.SendMessage(phone, model.Message);
                YG.SC.OpenShop.PCnCache.Instance.Add(model.Phone, randomCode);
                // 更新短信通道

                SmsLog smsModel = new SmsLog()
                {
                    PhoneNumber = model.Phone,
                    SendStatus  = smsResult
                    ,
                    Content = model.Message
                };
                _iCustomerService.SendSmsSaveLog(smsModel);
                return
                    ("ok");
                // SimpleResultModel.Conclude(ValidatePhoneStatus.验证码已发送);
            }
            catch (Exception ex)
            {
                return("-1");
                // return SimpleResultModel.Conclude(ValidatePhoneStatus.发送失败);
            }
        }