private void OrderTimeoutdalRun(object o) { if (_ordertimeoutdal == null) { _ordertimeoutdal = new OrderTimeOutRemindDAL(); } DataSet ds = _ordertimeoutdal.GetRemindData(); DataRowCollection rows = ds.Tables[0].Rows; int count = 0; foreach (DataRow item in rows) { string mobiles = item["mobiles"].ToString().Trim(); count += mobiles.Split(',').Count(); SMSHelper.SendMsg(mobiles, Config.OrderTimeOutRemindMsg); //记录日志 Config.PushLog("订单超时提醒", mobiles, Config.OrderTimeOutRemindMsg); } ConfigHelper.SetAppSettingVal("SMSSendCount", (ConfigHelper.GetAppSettingsString("SMSSendCount").ParseInt(0) + count).ToString()); }
//private object lockthis = new object(); /// <summary> /// 优惠卷过期提醒 任务 /// </summary> private void GoldBookRemindRun(object o) { if (_gbkdal == null) { _gbkdal = new GoldBookRemind_DAL(); } //加锁防止其他线程同时调用 线程过少不用加锁 DataSet ds = _gbkdal.GetRemindData(); DataRowCollection rows = ds.Tables[0].Rows; int count = 0; foreach (DataRow item in rows) { string mobiles = item["mobiles"].ToString().Trim(); count += mobiles.Split(',').Count(); SMSHelper.SendMsg(mobiles, Config.GoldBookRemindRemingMsg); //记录日志 Config.PushLog("优惠卷超时提醒", mobiles, Config.GoldBookRemindRemingMsg); } ConfigHelper.SetAppSettingVal("SMSSendCount", (ConfigHelper.GetAppSettingsString("SMSSendCount").ParseInt(0) + count).ToString()); }
private void NotLoginUserRun(object o) { if (_notloginuserremiddal == null) { _notloginuserremiddal = new NotLoginUserRemindDAL(); } DataSet ds = _notloginuserremiddal.GetRemindData(); DataRowCollection rows = ds.Tables[0].Rows; int count = 0; foreach (DataRow item in rows) { string mobiles = item["mobiles"].ToString().Trim(); count += mobiles.Split(',').Count(); SMSHelper.SendMsg(mobiles, Config.NotLoginUserRemingMsg); //记录日志 Config.PushLog("未登陆用户提醒", mobiles, Config.NotLoginUserRemingMsg); } ConfigHelper.SetAppSettingVal("SMSSendCount", (ConfigHelper.GetAppSettingsString("SMSSendCount").ParseInt(0) + count).ToString()); }
/// <summary> /// 推送系统工作是时间范围 /// </summary> /// <returns></returns> public static bool IsALLWork() { var timerange = ConfigHelper.GetAppSettingsString("SYSTEMWORKRANGETIME").Split(','); int hour = DateTime.Now.ToString("HH").ParseInt(); DateTime dt = DateTime.Now; DateTime start = Convert.ToDateTime(dt.ToString("yyyy-MM-dd") + " " + timerange[0].ParseInt(8) + ":00:00"); DateTime end = Convert.ToDateTime(dt.ToString("yyyy-MM-dd") + " " + timerange[1].ParseInt(22) + ":00:00"); return(dt >= start && dt <= end); }
protected override void WndProc(ref Message m) { const int WM_HOTKEY = 0x0312; //按快捷键 switch (m.Msg) { case WM_HOTKEY: switch (m.WParam.ToInt32()) { case 100: this.Hide(); break; case 101: this.Show(); break; case 102: var timestart = ConfigHelper.GetAppSettingsString("LASTSTARTTIME"); var timerange = ConfigHelper.GetAppSettingsString("SYSTEMWORKRANGETIME").Split(','); MessageBox.Show("速库消息推送后台\r\n当前版本:V2.0.0.0\r\nV1.0创建时间:2015.8.20 by gd \r\nV2.0更新时间:2015.9.15 by zl 协助修改 by gd\r\n\r\n系统最近一次启动时间:" + timestart + " \r\n系统工作时间范围:每日" + timerange[0] + "点 - " + timerange[1] + "点\r\n快捷键:win+A , win+Z , win+X 启动关闭所有任务:ctrl+F1\r\n\r\n短信发送条数总计:" + ConfigHelper.GetAppSettingsString("SMSSendCount") + " 条------------------------------------------------------------------\r\n如有疑问↓↓\r\nweibo:@大白2013\r\nmail:[email protected]", "提示"); break; case 103: if (timer_goldbookRemid.Tag.ToString() == "0") { GoldBookStart(); OrderTimeOutStart(); NotLoginUserStart(); JushOrderTimeOutStart(); JushNotLoginStart(); JushGoldBookStart(); JushAddGoldBookStart(); timingJushStart(); } else { GoldBookEnd(); OrderTimeOutEnd(); NotLoginUserEnd(); JushOrderTimeOutEnd(); JushNotLoginEnd(); JushGoldBookEnd(); JushAddGoldBookEnd(); timingJushEnd(); } break; } break; } base.WndProc(ref m); }
public static bool PushLog() { var setting1 = ConfigHelper.GetAppSettingsString("SYSTEMWORKRANGETIME").ToString(); var setting2 = ConfigHelper.GetAppSettingsString("MsgSendMaxCount").ToString(); var setting3 = ConfigHelper.GetAppSettingsString("GoldBookRemindTimeHour").ToString(); var setting4 = ConfigHelper.GetAppSettingsString("GoldBookRemindTimeInteval").ToString(); var setting5 = ConfigHelper.GetAppSettingsString("GoldBookRemindDayNum").ToString(); var setting6 = ConfigHelper.GetAppSettingsString("GoldBookRemindRemingMsg").ToString(); var setting7 = ConfigHelper.GetAppSettingsString("NotLoginUserTimeHour").ToString(); var setting8 = ConfigHelper.GetAppSettingsString("NotLoginUserTimeInteval").ToString(); var setting9 = ConfigHelper.GetAppSettingsString("NotLoginUserRemingMsg").ToString(); var setting10 = ConfigHelper.GetAppSettingsString("OrderTimeOutRemindHourNum").ToString(); var setting11 = ConfigHelper.GetAppSettingsString("OrderTimeOutRemindInteval").ToString(); var setting12 = ConfigHelper.GetAppSettingsString("OrderTimeOutRemindMsg").ToString(); var setting13 = ConfigHelper.GetConfigConnnString("DBCONNECTION").ToString(); var setting14 = ConfigHelper.GetAppSettingsString("ISINITSTARTWORK").ToString(); var setting15 = ConfigHelper.GetAppSettingsString("LOGBASEPATH").ToString(); //APP推送 var jushsetting1 = ConfigHelper.GetAppSettingsString("PushApp_key").ToString(); var jushsetting2 = ConfigHelper.GetAppSettingsString("PushMaster_secret").ToString(); var jushsetting3 = ConfigHelper.GetAppSettingsString("JushGoldBookRemindTimeHour1").ToString(); var jushsetting4 = ConfigHelper.GetAppSettingsString("JushGoldBookRemindTimeHour2").ToString(); var jushsetting5 = ConfigHelper.GetAppSettingsString("JushGoldBookRemindTimeInteval").ToString(); var jushsetting6 = ConfigHelper.GetAppSettingsString("JushGoldBookRemindRemingMsg").ToString(); var jushsetting7 = ConfigHelper.GetAppSettingsString("JushAddGoldBookRemindTimeHour1").ToString(); var jushsetting8 = ConfigHelper.GetAppSettingsString("JushAddGoldBookRemindTimeHour2").ToString(); var jushsetting9 = ConfigHelper.GetAppSettingsString("JushAddGoldBookRemindTimeInteval").ToString(); var jushsetting10 = ConfigHelper.GetAppSettingsString("JushAddGoldBookRemindRemingMsg").ToString(); var jushsetting11 = ConfigHelper.GetAppSettingsString("JushOrderTimeRemindHourHour1").ToString(); var jushsetting12 = ConfigHelper.GetAppSettingsString("JushOrderTimeRemindHourHour2").ToString(); var jushsetting13 = ConfigHelper.GetAppSettingsString("JushOrderTimeOutRemindInteval").ToString(); var jushsetting14 = ConfigHelper.GetAppSettingsString("JushOrderTimeOutRemindMsg").ToString(); var jushsetting15 = ConfigHelper.GetAppSettingsString("JushNotLoginUsersHour").ToString(); var jushsetting16 = ConfigHelper.GetAppSettingsString("JushNotLoginUsersDay").ToString(); var jushsetting17 = ConfigHelper.GetAppSettingsString("JushNotLoginUsersInteval").ToString(); var jushsetting18 = ConfigHelper.GetAppSettingsString("JushNotLoginUsersRemingMsg").ToString(); var jushsetting19 = ConfigHelper.GetAppSettingsString("JushTimingInteval").ToString(); if (string.IsNullOrWhiteSpace(setting1) || string.IsNullOrWhiteSpace(setting2) || string.IsNullOrWhiteSpace(setting3) || string.IsNullOrWhiteSpace(setting4) || string.IsNullOrWhiteSpace(setting5) || string.IsNullOrWhiteSpace(setting6) || string.IsNullOrWhiteSpace(setting7) || string.IsNullOrWhiteSpace(setting8) || string.IsNullOrWhiteSpace(setting9) || string.IsNullOrWhiteSpace(setting10) || string.IsNullOrWhiteSpace(setting11) || string.IsNullOrWhiteSpace(setting12) || string.IsNullOrWhiteSpace(setting13) || string.IsNullOrWhiteSpace(setting14) || string.IsNullOrWhiteSpace(setting15) || string.IsNullOrWhiteSpace(jushsetting1) || string.IsNullOrWhiteSpace(jushsetting2) || string.IsNullOrWhiteSpace(jushsetting3) || string.IsNullOrWhiteSpace(jushsetting4) || string.IsNullOrWhiteSpace(jushsetting5) || string.IsNullOrWhiteSpace(jushsetting6) || string.IsNullOrWhiteSpace(jushsetting7) || string.IsNullOrWhiteSpace(jushsetting8) || string.IsNullOrWhiteSpace(jushsetting9) || string.IsNullOrWhiteSpace(jushsetting10) || string.IsNullOrWhiteSpace(jushsetting11) || string.IsNullOrWhiteSpace(jushsetting12) || string.IsNullOrWhiteSpace(jushsetting13) || string.IsNullOrWhiteSpace(jushsetting14) || string.IsNullOrWhiteSpace(jushsetting15) || string.IsNullOrWhiteSpace(jushsetting16) || string.IsNullOrWhiteSpace(jushsetting17) || string.IsNullOrWhiteSpace(jushsetting18) || string.IsNullOrWhiteSpace(jushsetting19) ) { string.Format(">>警告:系统配置异常(详细见日志文件),time:{0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")).WriteLog("ERROR"); return(false); } else { //记录SMS配置系统日志 string.Format("==============================================================SMS系统配置================================================================\r\n" + "系统启动成功,启动时间{0},当前系统配置:系统工作时间 单位/h:{1},群发手机最大数量:{2}" + "\r\n优惠卷超时:工作时间:{3},工作频率:{4} ms/次,提前提醒时间{5}天,提醒内容:{6}" + "\r\n未登陆用户:工作时间:{7},工作频率:{8} ms/次,提醒内容:{9}" + "\r\n订单超时:工作时间:{10},工作频率:{11} ms/次,提醒内容:{12}" + "\r\n==============================================================SMS系统配置================================================================", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), setting1, setting2, setting3, setting4, setting5, setting6, setting7, setting8, setting9, setting10, setting11, setting12 ).WriteLog(); //记录APP配置系统日志 string.Format("==============================================================APP推送系统配置================================================================\r\n" + "系统启动成功,启动时间{0}" + "\r\nAPP推送优惠券超时:工作时间1:{1},工作时间2:{2},工作频率:{3},提醒内容:{4}" + "\r\nAPP推送优惠券新增:工作时间1:{5},工作时间2:{6},工作频率:{7},提醒内容:{8}" + "\r\nAPP推送订单超时:工作时间1:{9},工作时间2:{10},工作频率:{11},提醒内容:{12}" + "\r\nAPP推送登录提醒:工作时间1:{13},工作时间2:{14},工作频率:{15},提醒内容:{16}" + "\r\nAPP定时推送:工作频率:{17}" + "\r\n==============================================================APP推送系统配置================================================================", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), jushsetting3, jushsetting4, jushsetting5, jushsetting6, jushsetting7, jushsetting8, jushsetting9, jushsetting10, jushsetting11, jushsetting12, jushsetting13, jushsetting14, jushsetting15, jushsetting16, jushsetting17, jushsetting18, jushsetting19 ).WriteLog(true); return(true); } }
private bool IsInitStart() { return(ConfigHelper.GetAppSettingsString("ISINITSTARTWORK").ToString().Trim() == "ON"); }