/// <summary> /// 执行微信关注数据相关操作 /// </summary> public static WechatFollowReportType WechatFollowReportWork(int AccountManageID) { WechatFollowReportType result = WechatFollowReportType.Error; //取得最新微信关注数据 BaseService <WechatFollowReport> ser = new BaseService <WechatFollowReport>(); WechatFollowReport wechatFollowReport = ser.Repository.Entities.OrderByDescending( a => a.StatisticsDate).FirstOrDefault(); DateTime dtCheckDate = Convert.ToDateTime(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd")); //如果当天未进行过统计,向微信关注表追加数据 if (wechatFollowReport == null || dtCheckDate > wechatFollowReport.StatisticsDate) { InsertWechatFollowReport(AccountManageID); result = WechatFollowReportType.Success; } else { result = WechatFollowReportType.AlreadyCreated; } return(result); }
public ActionResult ReportGenerate() { WechatFollowReportType result = WechatFollowReportCommon.WechatFollowReportWork(AccountManageID); if (result == WechatFollowReportType.Success) { return(SuccessNotification("数据统计成功!")); } else if (result == WechatFollowReportType.AlreadyCreated) { return(ErrorNotification("今天已经进行过统计,请明天再试!")); } else { return(ErrorNotification("系统发生错误!无法进行统计!")); } }
public void Execute() { try { string dateTimeFormat = "HH:mm:ss"; DateTime dtNow = Convert.ToDateTime(DateTime.Now.ToString(dateTimeFormat)); DateTime dtStandard = Convert.ToDateTime(jobExecuteTime); if (dtNow < dtStandard) { return; } WechatFollowReportType result = WechatFollowReportCommon.WechatFollowReportWork(); } catch (Exception ex) { LogManager.GetLogger(this.GetType()).Error("WechatFollowReport Error", ex); } }