Example #1
0
        /// <summary>
        /// send the short message to notice the customer
        /// </summary>
        /// <param name="body">short message body</param>
        public static void SendTheShortMessage(SMSInfo body, JobContext context)
        {
            if (string.IsNullOrEmpty(body.CellPhoneNum))
            {
                return;
            }
            else
            {
                body.CellPhoneNum = Util.TrimNull(body.CellPhoneNum);
            }
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];

            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;
            var ar = client.Create("/Message/SendSMS", body, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                Logger.WriteLog(errorMsg, "JobConsole");
            }
        }
Example #2
0
        public ActionResult SendFindPasswordSMS(FormCollection form)
        {
            string cell = CookieHelper.GetCookie <String>("FindPasswordCustomerCellPhone");

            if (!string.IsNullOrEmpty(cell))
            {
                SMSInfo item = new SMSInfo();
                //item.CustomerSysNo = int.Parse(CookieHelper.GetCookie<String>("FindPasswordCustomerSysNo"));
                item.CreateUserSysNo = int.Parse(CookieHelper.GetCookie <String>("FindPasswordCustomerSysNo"));
                item.CellNumber      = cell;
                item.Status          = SMSStatus.NoSend;
                item.Type            = SMSType.FindPassword;
                item.Priority        = 100;
                item.RetryCount      = 0;

                string code = VerifyImage.CreateRandomNumber();

                CookieHelper.SaveCookie <string>("FindPasswordSMSCode", code);
                item.SMSContent = string.Format(AppSettingManager.GetSetting("SMSTemplate", "AlertConfirmPhoneCode"),
                                                DateTime.Now.ToString("MM月dd日 HH:mm"), code);
                if (CommonFacade.InsertNewSMS(item))
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }
Example #3
0
 /// <summary>
 /// 发短信息,给云服务
 /// </summary>
 /// <param name="sms"></param>
 public void SendSMSToCloud(SMSInfo sms)
 {
     if (SendSMSWatchEvent != null)
     {
         SendSMSWatchEvent(sms);
     }
 }
Example #4
0
        public static int SendSMS(string strToMobile, string strType, string strContent, string strValidateCode, ref string retResult)
        {
            int  result = 0;
            ISMS iSMS   = SMSProvider.Create();

            if (iSMS != null)
            {
                iSMS.Mobile     = strToMobile;
                iSMS.SMSContent = strContent;
                retResult       = iSMS.SendMsg();
                if (iSMS.IsSuccess)
                {
                    SMSInfo entity = new SMSInfo
                    {
                        SMSMob        = iSMS.Mobile,
                        SMSText       = iSMS.SMSContent,
                        SMSType       = strType,
                        ValidateCode  = strValidateCode,
                        ReturnMsg     = retResult,
                        Status        = 1,
                        AutoTimeStamp = DateTime.Now
                    };
                    result = BLL.SMS.Add(entity);
                }
            }
            return(result);
        }
Example #5
0
        public static void CreateTest()
        {
            Console.WriteLine("读取用户基本数据(测试集)");
            var user_test = BasicInfo_Test.ReadCSV(@"F:\诈骗电话识别\诈骗电话号码识别-0527\test\test_user.csv");

            Console.WriteLine("件数:" + user_test.Count);

            Console.WriteLine("读取用户APP数据(测试集)");
            var app_test = AppInfo.ReadCSV(@"F:\诈骗电话识别\诈骗电话号码识别-0527\test\test_app.csv");

            Console.WriteLine("件数:" + app_test.Count);

            Console.WriteLine("读取用户VOC数据(测试集)");
            var voc_test = VocInfo.ReadCSV(@"F:\诈骗电话识别\诈骗电话号码识别-0527\test\test_voc.csv");

            Console.WriteLine("件数:" + voc_test.Count);

            Console.WriteLine("读取用户SMS数据(测试集)");
            var sms_test = SMSInfo.ReadCSV(@"F:\诈骗电话识别\诈骗电话号码识别-0527\test\test_sms.csv");

            Console.WriteLine("件数:" + sms_test.Count);

            //app数据分组
            output(user_test, App_Agg.GetAgg(app_test), Voc_Agg.GetAgg(voc_test), SMS_Agg.GetAgg(sms_test), @"F:\诈骗电话识别\诈骗电话号码识别-0527\test_all.csv");
        }
Example #6
0
        /// <summary>
        /// 更改用户密码
        /// </summary>
        /// <param name="customerId">用户Id</param>
        /// <param name="oldPassword">旧密码</param>
        /// <param name="newPassword">新密码</param>
        /// <returns>更新结果</returns>
        public static bool UpdateCustomerPassword(string customerId, string oldPassword, string newPassword)
        {
            var result = CustomerDA.UpdateCustomerPassword(customerId, oldPassword, newPassword);

            if (result)
            {
                //密码修改成功后发送短信
                var customer = CustomerFacade.GetCustomerByID(customerId);
                if (customer.IsPhoneValided == 1)
                {
                    var sms = new SMSInfo();
                    sms.CellNumber       = customer.CellPhone;
                    sms.CompanyCode      = ConstValue.CompanyCode;
                    sms.CreateTime       = DateTime.Now;
                    sms.CreateUserSysNo  = customer.SysNo;
                    sms.LanguageCode     = ConstValue.LanguageCode;
                    sms.Priority         = 1;
                    sms.SMSContent       = AppSettingManager.GetSetting("SMSTemplate", "AlertUpdatePassword");
                    sms.Status           = SMSStatus.NoSend;
                    sms.StoreCompanyCode = ConstValue.StoreCompanyCode;
                    sms.Type             = SMSType.AlertUpdatePassword;
                    sms.RetryCount       = 0;
                    CommonDA.InsertNewSMS(sms);
                }
            }
            return(result);
        }
Example #7
0
        private void OutWebsiteSMS()
        {
            string ToMobile = RequestHelper.GetQueryString <string>("ToMobile");
            string Content  = RequestHelper.GetQueryString <string>("Content");
            string TempleId = RequestHelper.GetQueryString <string>("TempleId");
            string CallBack = RequestHelper.GetQueryString <string>("callback");

            SMSInfo SMSModel = new SMSInfo();

            SMSModel.AppId    = "8a48b551506925be01506a33f41504f1";
            SMSModel.TempleId = TempleId;
            SMSModel.Mobile   = ToMobile;
            //SMSModel.Content = new string[] { Content, CheckCode, SMSConfig.CodeTimeOut.ToString() };
            SMSModel.Content = HttpUtility.UrlDecode(Content).Split(',');

            Response.Write(CallBack);
            YXTSMS.YXTSMS api = new YXTSMS.YXTSMS();

            //if (api.init())
            //{
            //    Dictionary<string, object> retData = api.SendTemplateSMS(SMSModel);
            //    Response.Write(retData["statusCode"].ToString());
            //}

            if (api.SendSMS(SMSModel))
            {
                Response.Write("({\"result\":true})");
            }
            else
            {
                Response.Write("({\"result\":false})");
            }
        }
Example #8
0
        public MainWindow()
        {
            InitializeComponent();

            diaopen = new OpenFileDialog()
            {
                Filter = "百度API配置文件|*.bxml"
            };
            diasave = new SaveFileDialog()
            {
                Filter = "百度API配置文件|*.bxml"
            };

            sms     = new SMSSender(new BCE(new BCESettings()), new SMSSettings());
            smsinfo = new SMSInfo();

            hppSms.PredefinedPropertyAttributeDictionary = new Dictionary <string, PropertyPanelAttribute>()
            {
                { "ContentVar", new PropertyPanelAttribute()
                  {
                      Order = -1
                  } }
            };

            DataContext = this;
        }
Example #9
0
        public void InsertNewSMS(SMSInfo item)
        {
            IDataCommand datacommand = IocManager.Instance.Resolve <IDataCommand>();

            datacommand.CreateCommand("CustomerInsertNewSMS");

            //DataCommand datacommand = new DataCommand("CustomerInsertNewSMS");
            datacommand.SetParameter <SMSInfo>(item);
            datacommand.ExecuteNonQuery();
        }
Example #10
0
        public static bool InsertNewSMS(SMSInfo item)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("InsertNewSMS");

            item.CompanyCode      = ConstValue.CompanyCode;
            item.StoreCompanyCode = ConstValue.StoreCompanyCode;
            item.LanguageCode     = ConstValue.LanguageCode;
            cmd.SetParameterValue <SMSInfo>(item);
            int result = cmd.ExecuteNonQuery();

            return(result > 0 ? true : false);
        }
Example #11
0
        private void btnSMS_Click(object sender, RoutedEventArgs e)
        {
            string account = TextBoxLoginName.Text;

            if (string.IsNullOrEmpty(account))
            {
                this.TextBlockLoginFaild.Visibility = System.Windows.Visibility.Visible;
                TextBlockLoginFaild.Text            = "用户名未提供,发送验证码失败。";
                return;
            }

            string     serviceUrl = CPApplication.Current.CommonData["ECCentralServiceURL_Login"].ToString();
            string     userUrl    = string.Format("{0}/CommonService/ControlPanelUser/LoginUser", serviceUrl);
            RestClient c_Client   = new RestClient(serviceUrl);

            c_Client.Query <ControlPanelUser>(userUrl, account, (target, args) =>
            {
                if (args == null || args.Result == null)
                {
                    this.TextBlockLoginFaild.Visibility = Visibility.Visible;
                    TextBlockLoginFaild.Text            = "账户未绑定手机或是未完成验证绑定,获取验证码失败。";
                    return;
                }
                //step two :send sms
                if (string.IsNullOrEmpty(args.Result.PhoneNumber))
                {
                    this.TextBlockLoginFaild.Visibility = Visibility.Visible;
                    TextBlockLoginFaild.Text            = "账户未绑定手机或是未完成验证绑定,获取验证码失败。";
                    return;
                }
                else
                {
                    string code       = ValidationCodeHelper.CreateValidateCode(5);
                    string SMSContent = string.Format("您于{0}在泰隆优选申请验证手机。动态验证码:{1}",
                                                      DateTime.Now.ToString("MM月dd日 HH:mm"), code);
                    string smsurl       = string.Format("{0}/CommonService/Message/SendSMS", serviceUrl);
                    RestClient m_Client = new RestClient(serviceUrl);

                    SMSInfo smsc = new SMSInfo()
                    {
                        CellPhoneNum = args.Result.PhoneNumber,
                        Content      = SMSContent,
                        Priority     = 3
                    };
                    m_Client.Query <List <Question> >(smsurl, smsc, (target1, args1) =>
                    {
                        UtilityHelper.SetIsolatedStorage("smsDate", DateTime.Now.ToString());
                        UtilityHelper.SetIsolatedStorage("smsCode", code);
                    });
                }
            });
        }
Example #12
0
 private void map(SMSInfo oParam, DataRow tempdr)
 {
     oParam.SysNo           = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.CellNumber      = Util.TrimNull(tempdr["CellNumber"]);
     oParam.SMSContent      = Util.TrimNull(tempdr["SMSContent"]);
     oParam.Priority        = Util.TrimIntNull(tempdr["Priority"]);
     oParam.RetryCount      = Util.TrimIntNull(tempdr["RetryCount"]);
     oParam.CreateUserSysNo = Util.TrimIntNull(tempdr["CreateUserSysNo"]);
     oParam.CreateTime      = Util.TrimDateNull(tempdr["CreateTime"]);
     oParam.ExpectSendTime  = Util.TrimDateNull(tempdr["ExpectSendTime"]);
     oParam.HandleTime      = Util.TrimDateNull(tempdr["HandleTime"]);
     oParam.Status          = Util.TrimIntNull(tempdr["Status"]);
 }
Example #13
0
        private bool IsExistsSMS(SMSInfo oInfo)
        {
            string  sql = "select * from sms where cellnumber=" + oInfo.CellNumber + " and smscontent=" + Util.ToSqlString(Util.SafeFormat(oInfo.SMSContent.Trim()));
            DataSet ds  = SqlHelper.ExecuteDataSet(sql);

            if (Util.HasMoreRow(ds))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #14
0
        public static int Add(SMSInfo entity)
        {
            int result;

            if (entity == null)
            {
                result = 0;
            }
            else
            {
                result = BizBase.dbo.InsertModel <SMSInfo>(entity);
            }
            return(result);
        }
Example #15
0
        private void GetMobildCode(string strSMSType)
        {
            string randomNumber = StringUtils.GetRandomNumber(5, true);
            string strContent   = string.Empty;

            if (strSMSType == "reg")
            {
                strContent = base.GetConfigValue("RegSMSCheckCode").Replace("${checkcode}", randomNumber);
            }
            else if (strSMSType == "findpwd")
            {
                strContent = base.GetConfigValue("GetPwdSMSCheckCode").Replace("${username}", WebUtils.GetQueryString("username")).Replace("${checkcode}", randomNumber);
            }
            else if (strSMSType == "bind")
            {
                strContent = base.GetConfigValue("BindSMSCheckCode").Replace("${username}", WebUtils.GetQueryString("username")).Replace("${checkcode}", randomNumber);
            }
            string queryString = WebUtils.GetQueryString("paramval");
            string s           = "{\"ret\":\"fail\",\"timeout\":0,\"msg\":\"短信验证码发送失败\"}";
            bool   flag        = true;

            if (!string.IsNullOrEmpty(queryString))
            {
                if ((strSMSType == "reg" || strSMSType == "bind") && SinGooCMS.BLL.User.IsExistsByMobile(queryString))
                {
                    s = "{\"ret\":\"exists\",\"timeout\":0,\"msg\":\"手机号码已经存在\"}";
                }
                else
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(queryString);
                    if (lastCheckCode != null)
                    {
                        System.TimeSpan timeSpan = System.DateTime.Now - lastCheckCode.AutoTimeStamp;
                        if (timeSpan.TotalSeconds < 60.0)
                        {
                            flag = false;
                            s    = "{\"ret\":\"fail\",\"timeout\":" + (60.0 - timeSpan.TotalSeconds).ToString("f0") + ",\"msg\":\"发送间隔太短\"}";
                        }
                    }
                    if (flag)
                    {
                        if (MsgService.SendSMSCheckCode(queryString, strContent, randomNumber) > 0)
                        {
                            s = "{\"ret\":\"success\",\"timeout\":60,\"msg\":\"短信验证码发送成功,请注意查收!\"}";
                        }
                    }
                }
            }
            base.Response.Write(s);
        }
Example #16
0
        public static void SendSMS(SMSInfo tmpSMSInfo)
        {
            DataCommand command = DataCommandManager.GetDataCommand("InsertSMS");

            command.SetParameterValue("@CellNumber", tmpSMSInfo.CellNumber);
            command.SetParameterValue("@SMSContent", tmpSMSInfo.SMSContent);
            command.SetParameterValue("@Priority", tmpSMSInfo.Priority);
            command.SetParameterValue("@RetryCount", tmpSMSInfo.RetryCount);
            command.SetParameterValue("@CreateTime", tmpSMSInfo.CreateTime);
            command.SetParameterValue("@HandleTime", tmpSMSInfo.HandleTime);
            command.SetParameterValue("@Status", tmpSMSInfo.Status);
            command.SetParameterValue("@CreateUserSysNo", tmpSMSInfo.CreateUserSysNo);

            command.ExecuteNonQuery();
        }
Example #17
0
        private void Get_ParameterList()
        {
            SmsLog bllSms = new SmsLog();
            string strSql = PubFunction.GetShopAuthority(this._UserShopID, "ShopID", "1=1");

            this.lblMonthNumber.Text = bllSms.GetSmsMonthNumber(strSql).ToString();
            this.lblTotalNumber.Text = bllSms.GetSmsTotalNumber(strSql).ToString();
            try
            {
                SysParameter sds = new SysParameter();
                if (sds.GetModel(1).Sms)
                {
                    this.lblNotificationSMSBalance.Text = SMSInfo.GetBalance(false);
                }
                else
                {
                    this.TongZhiduanxin.Attributes.Add("style", "display:none");
                }
                if (sds.GetModel(1).MarketingSMS)
                {
                    this.lblMarketingSMSBalance.Text = SMSInfo.GetBalance(true);
                }
                else
                {
                    this.Yinxiaoduanxin.Attributes.Add("style", "display:none");
                }
            }
            catch
            {
            }
            int       Counts = this.NetPagerParameter.RecordCount;
            DataTable db     = bllSms.GetSmsShopReport(this.NetPagerParameter.PageSize, this.NetPagerParameter.CurrentPageIndex, out Counts, new string[]
            {
                strSql
            }).Tables[0];

            this.NetPagerParameter.RecordCount    = Counts;
            this.NetPagerParameter.CustomInfoHTML = string.Format("<div class=\"results\"><span>当前第{0}/{1}页 共{2}条记录 每页{3}条</span></div>", new object[]
            {
                this.NetPagerParameter.CurrentPageIndex,
                this.NetPagerParameter.PageCount,
                this.NetPagerParameter.RecordCount,
                this.NetPagerParameter.PageSize
            });
            this.gvSmsShopReport.DataSource = db;
            this.gvSmsShopReport.DataBind();
            PageBase.BindSerialRepeater(this.gvSmsShopReport, this.NetPagerParameter.PageSize * (this.NetPagerParameter.CurrentPageIndex - 1));
        }
Example #18
0
        public void Insert(SMSInfo oInfo)
        {
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                //防止重复扫描,相同的短信只发送一次
                if (!IsExistsSMS(oInfo))
                {
                    new SMSDac().Insert(oInfo);
                }
                scope.Complete();
            }
        }
Example #19
0
        private void SendCode()
        {
            string Mobile = RequestHelper.GetQueryString <string>("Mobile");

            if (!string.IsNullOrEmpty(Mobile))
            {
                UserSearchInfo userSearch = new UserSearchInfo();
                userSearch.Mobile = Mobile;
                List <UserInfo> userList = UserBLL.SearchUserList(userSearch);
                if (userList.Count > 0)
                {
                    YXTSMS.YXTSMS api       = new YXTSMS.YXTSMS();
                    string        CheckCode = api.MakeCode();

                    SMSInfo SMSModel = new SMSInfo();
                    SMSModel.Mobile  = Mobile;
                    SMSModel.Content = new string[] { "找回密码", CheckCode, "2" };
                    if (api.SendSMS(SMSModel))
                    {
                        SMSRecordInfo SMSRecordModel = new SMSRecordInfo();
                        SMSRecordModel.Mobile         = SMSModel.Mobile;
                        SMSRecordModel.VerCode        = CheckCode;
                        SMSRecordModel.DataCreateDate = DateTime.Now;
                        SMSRecordBLL.AddSMSRecord(SMSRecordModel);

                        //验证码加密后写入Cookies中
                        CookiesHelper.AddCookie("SMSCheckCode", StringHelper.Encode(CheckCode, "SMS"), 2, TimeType.Minute);
                        ResponseHelper.Write("0|发送成功!");
                    }
                    else
                    {
                        ResponseHelper.Write("1|发送失败!");
                    }
                }
                else
                {
                    ResponseHelper.Write("2|手机号码不存在!");
                }
            }
            else
            {
                ResponseHelper.Write("1|号码获取失败!");
            }
        }
Example #20
0
    public static List <SMSInfo> ReadCSV(string filename)
    {
        var df = new List <SMSInfo>();
        var sr = new StreamReader(filename);

        sr.ReadLine();  //第一行
        while (!sr.EndOfStream)
        {
            var rawinfo = sr.ReadLine().Split(",");
            var r       = new SMSInfo();
            r.phone_no_m       = rawinfo[0];
            r.opposite_no_m    = rawinfo[1];
            r.calltype_id      = rawinfo[2];
            r.request_datetime = DateTime.Parse(rawinfo[3]);
            df.Add(r);
        }
        sr.Close();
        return(df);
    }
Example #21
0
        /// <summary>
        /// Search for the emails to be send
        /// </summary>
        /// <returns></returns>
        public Hashtable SearchAsyncSMS()
        {
            string    sql     = @"select * 
							from sms
							where expectsendtime < getdate() and status = 0"                            ;
            DataSet   ds      = SqlHelper.ExecuteDataSet(sql);
            Hashtable smsHash = new Hashtable(5);

            if (Util.HasMoreRow(ds))
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    SMSInfo oInfo = new SMSInfo();
                    this.map(oInfo, dr);
                    smsHash.Add(oInfo, null);
                }
            }
            return(smsHash);
        }
Example #22
0
        public int UpdateSMSStatus(SMSInfo oParam)
        {
            string     sql = @"UPDATE sms SET 
                           Status=@Status,HandleTime=@HandleTime 
                           WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo      = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramStatus     = new SqlParameter("@Status", SqlDbType.Int, 4);
            SqlParameter paramHandleTime = new SqlParameter("@HandleTime", SqlDbType.DateTime);

            if (oParam.SysNo != AppConst.IntNull)
            {
                paramSysNo.Value = oParam.SysNo;
            }
            else
            {
                paramSysNo.Value = System.DBNull.Value;
            }
            if (oParam.Status != AppConst.IntNull)
            {
                paramStatus.Value = oParam.Status;
            }
            else
            {
                paramStatus.Value = System.DBNull.Value;
            }
            if (oParam.HandleTime != AppConst.DateTimeNull)
            {
                paramHandleTime.Value = oParam.HandleTime;
            }
            else
            {
                paramHandleTime.Value = System.DBNull.Value;
            }

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramStatus);
            cmd.Parameters.Add(paramHandleTime);

            return(SqlHelper.ExecuteNonQuery(cmd));
        }
Example #23
0
        /// <summary>
        /// 创建手机号码验证对象
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public static CellPhoneConfirm CreateCellPhoneConfirm(CellPhoneConfirm entity)
        {
            var     temp = CustomerDA.CreateCellPhoneConfirm(entity);
            SMSInfo item = new SMSInfo(); //发送验证码短信

            item.CreateUserSysNo = entity.CustomerSysNo;
            item.CellNumber      = entity.CellPhone;
            item.Status          = SMSStatus.NoSend;
            item.Type            = SMSType.VerifyPhone;
            item.Priority        = 100;
            item.RetryCount      = 0;
            item.SMSContent      = string.Format(AppSettingManager.GetSetting("SMSTemplate", "CreateConfirmPhoneCode"), DateTime.Now.ToString("MM月dd日 HH:mm"), entity.ConfirmKey);
            int smsResult = 0;

            CommonFacade.InsertNewSMS(item, out smsResult);
            if (smsResult == -99999)//表明非法发送验证码
            {
                temp       = new CellPhoneConfirm();
                temp.SysNo = -99999;
            }
            return(temp);
        }
Example #24
0
        public void UpdateSMSRetryCount(SMSInfo oInfo)
        {
            string sql = "";

            if (oInfo.RetryCount == 0) //1小时后再补发一次
            {
                sql = "update sms set retrycount=1,expectsendtime=DATEADD(hour, 1, getdate()) where sysno=" + oInfo.SysNo;
            }
            else if (oInfo.RetryCount == 1) //3小时后再补发一次
            {
                sql = "update sms set retrycount=2,expectsendtime=DATEADD(hour, 2, getdate()) where sysno=" + oInfo.SysNo;
            }
            else if (oInfo.RetryCount == 2)  //24小时后再补发一次
            {
                sql = "update sms set retrycount=3,expectsendtime=DATEADD(hour, 21, getdate()) where sysno=" + oInfo.SysNo;
            }
            else if (oInfo.RetryCount == 3) //作废掉
            {
                sql = "update sms set status=" + (int)AppEnum.TriStatus.Abandon + " where sysno=" + oInfo.SysNo;
            }
            SqlHelper.ExecuteNonQuery(sql);
        }
Example #25
0
        public static void CreateTrain()
        {
            Console.WriteLine("读取用户基本数据(训练集)");
            var user_train = BasicInfo_Train.ReadCSV(@"F:\诈骗电话识别\诈骗电话号码识别-0527\train\train_user.csv");

            Console.WriteLine("件数:" + user_train.Count);
            Console.WriteLine("正样本:" + user_train.Count(x => x.label == "1"));
            Console.WriteLine("负样本:" + user_train.Count(x => x.label == "0"));

            Console.WriteLine("读取用户APP数据(训练集)");
            var app_train = AppInfo.ReadCSV(@"F:\诈骗电话识别\诈骗电话号码识别-0527\train\train_app.csv");

            Console.WriteLine("件数:" + app_train.Count);
            var app_agg = App_Agg.GetAgg(app_train);

            app_train.Clear();
            GC.Collect();

            Console.WriteLine("读取用户VOC数据(训练集)");
            var voc_train = VocInfo.ReadCSV(@"F:\诈骗电话识别\诈骗电话号码识别-0527\train\train_voc.csv");

            Console.WriteLine("件数:" + voc_train.Count);
            var voc_agg = Voc_Agg.GetAgg(voc_train);

            voc_train.Clear();
            GC.Collect();

            Console.WriteLine("读取用户SMS数据(训练集)");
            var sms_train = SMSInfo.ReadCSV(@"F:\诈骗电话识别\诈骗电话号码识别-0527\train\train_sms.csv");

            Console.WriteLine("件数:" + sms_train.Count);
            var sms_agg = SMS_Agg.GetAgg(sms_train);

            sms_train.Clear();
            GC.Collect();

            output(user_train, app_agg, voc_agg, sms_agg, @"F:\诈骗电话识别\诈骗电话号码识别-0527\train_all.csv");
        }
Example #26
0
        public ActionResult SendLoginValidSMS(FormCollection form)
        {
            //step one :get customer cellphone from db
            string customerID = form["CustomerID"];

            if (string.IsNullOrEmpty(customerID))
            {
                return(Json("账户名未提供,发送验证码失败。", JsonRequestBehavior.AllowGet));
            }
            var    customer          = CustomerFacade.GetCustomerByID(customerID);
            string customerCellphone = customer.CellPhone;

            //step two :send sms
            if (string.IsNullOrEmpty(customerCellphone) || customer.IsPhoneValided == 0)
            {
                return(Json("账户未绑定手机或是未完成验证绑定,获取验证码失败。", JsonRequestBehavior.AllowGet));
            }
            else
            {
                SMSInfo item = new SMSInfo();
                item.CreateUserSysNo = customer.SysNo;
                item.CellNumber      = customer.CellPhone;
                item.Status          = SMSStatus.NoSend;
                item.Type            = SMSType.VerifyPhone;
                item.Priority        = 100;
                item.RetryCount      = 0;

                string code = VerifyImage.CreateRandomNumber();
                CookieHelper.SaveCookie <string>("VerifyCode", code);
                item.SMSContent = string.Format(AppSettingManager.GetSetting("SMSTemplate", "CreateConfirmPhoneCode"),
                                                DateTime.Now.ToString("MM月dd日 HH:mm"), code);
                if (CommonFacade.InsertNewSMS(item))
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }
Example #27
0
        private static List <Sms> ReadSms(CSource source)
        {
            var sms = new List <Sms>();

            source.Sms.Items.Update();

            foreach (CSmsItem item in source.Sms.Items)
            {
                var s     = new Sms();
                var sInfo = new SMSInfo()
                {
                    State         = (short)item.State,
                    Text          = item.Text,
                    Status        = (byte)item.Status,
                    ServiceCenter = item.ServiceCenter
                };
                s.SMSInfo = sInfo;
                if (item.Type == CSmsItem.EType.Deliver)
                {
                    sInfo.FromNumber        = item.Number;
                    sInfo.ReceivedTimeStamp = item.ReceivedTime;
                    sInfo.ReceivedTimeZone  = item.ReceivedTimezone;
                    sInfo.Type    = (short)CSmsItem.EType.Deliver;
                    s.SendReceive = SmsSendReceive.Received;
                }
                else if (item.Type == CSmsItem.EType.Submit)
                {
                    sInfo.ToNumber      = item.Number;
                    sInfo.SentTimeStamp = item.SentTime;
                    sInfo.Type          = (short)CSmsItem.EType.Submit;
                    s.SendReceive       = SmsSendReceive.Sent;
                }
                sms.Add(s);
                //Console.WriteLine(item.Type.ToString() + "\r\n" + item.State.ToString() + "\r\n" +
                //    item.Number + "\r\n" + item.Text + "\r\nReceived time: " + item.ReceivedTime + "\r\nSent time: " + item.SentTime + "\r\n" + "\r\n\r\n");
            }
            return(sms);
        }
Example #28
0
        private static void loadData()
        {
            using (DataStore ds = new DataStore())
            {
                String      guid1   = "01123304408844223";
                dDeviceInfo devInfo = new dDeviceInfo();
                devInfo.Label     = "IPHONE 5";
                devInfo.OwnerName = "Steven";
                devInfo.OwnerID   = "310112345677890x";
                dDevice dev1 = ds.createDevice(guid1, "phone", devInfo);
                dDevice dev2 = ds.createDevice(guid1, "phone");
                devInfo.Label = "GSM";
                dDevice dev3 = ds.createDevice("394485837722722055055", "SIMCard", devInfo, dev1);
                for (int i = 0; i < 100; ++i)
                {
                    dev1.addCall("123456789", 30, 0,
                                 DateTime.Parse("2013/4/3 12:41:22"),
                                 DateTime.Parse("2013/4/3 12:41:52"), 0);
                    dContact helen = dev1.createContact("Helen " + i, i);
                    helen.addTextProp((int)datasource.dContact.PropertyType.HOME_NUM, "abc");
                    helen.addDateTimeProp((int)datasource.dContact.PropertyType.DATE, DateTime.Now);
                    byte[] data = System.Text.Encoding.Unicode.GetBytes("data" + i);
                    helen.addBinaryProp((int)datasource.dContact.PropertyType.ITEMPICTURE, data, 0, data.Length);
                    SMSInfo smsInfo = new SMSInfo();
                    smsInfo.FromNumber = "938740182" + i;
                    smsInfo.Text       = "hello" + i;
                    dev3.addSMS(0x02008000, smsInfo);
                }

                dDevFileSystem devFS = dev1.createDevFileSystem("D:\\Steven\\temp");
                DirectoryInfo  dir   = new DirectoryInfo("D:\\HEROSOFT");
                copyDir(dir, dir.FullName, devFS);
                ds.commit();
                // rollback
                dDevice dev = ds.createDevice("never be added", "PHONE");
            }
        }
Example #29
0
        private void SMSSend(string Mobile, string Content, string TempleId)
        {
            YXTSMS.YXTSMS api       = new YXTSMS.YXTSMS();
            string        CheckCode = api.MakeCode();

            SMSInfo SMSModel = new SMSInfo();

            SMSModel.TempleId = TempleId;
            SMSModel.Mobile   = Mobile;
            switch (TempleId)
            {
            case "17101":
                SMSModel.Content = new string[] { Content, CheckCode, SMSConfig.CodeTimeOut.ToString() };
                break;

            case "210196":
                SMSModel.Content = new string[] { CheckCode, SMSConfig.CodeTimeOut.ToString() };
                break;
            }
            //SMSModel.Content = new string[] { Content, CheckCode, SMSConfig.CodeTimeOut.ToString() };

            if (api.SendSMS(SMSModel))
            {
                SMSRecordInfo SMSRecordModel = new SMSRecordInfo();
                SMSRecordModel.Mobile         = SMSModel.Mobile;
                SMSRecordModel.VerCode        = CheckCode;
                SMSRecordModel.DataCreateDate = DateTime.Now;
                SMSRecordBLL.AddSMSRecord(SMSRecordModel);
                //验证码加密后写入Cookies中
                CookiesHelper.AddCookie("SMSCheckCode", StringHelper.Encode(CheckCode, "SMS"), SMSConfig.CodeTimeOut, TimeType.Minute);
                ResponseHelper.Write("0|发送成功!");
            }
            else
            {
                ResponseHelper.Write("1|发送失败!");
            }
        }
Example #30
0
 public static bool InsertNewSMS(SMSInfo item)
 {
     item.IPAddress = GetIP();
     return(CommonDA.InsertNewSMS(item));
 }