diff --git a/B3WeChat.Web/PluginClass.cs b/B3WeChat.Web/PluginClass.cs index 5f2bb27..7b489a4 100644 --- a/B3WeChat.Web/PluginClass.cs +++ b/B3WeChat.Web/PluginClass.cs @@ -1,6 +1,7 @@ using Bwp.MainSystem; using Bwp.MainSystem.Auth; using Bwp.Web.Pages; +using BWP.B3WeChat.Tasks; using BWP.B3WeChat.Utils; using Forks.EnterpriseServices.BusinessInterfaces; using Forks.Utils; @@ -45,6 +46,7 @@ namespace BWP.Web var roleSchemas = Wpf.Settings.RoleSchemas; roleSchemas.Add(new RoleSchema("wechat", "微信公众号用户", RoleSchema.DefaultFunctions.Empty)); Global.RegisterCustomPrePam(new WeChatAuth()); + ClearExpiredApproveMessagesTask.Register(); } } } diff --git a/B3WeChat/B3WeChat.csproj b/B3WeChat/B3WeChat.csproj index 8ec4ada..cb448e3 100644 --- a/B3WeChat/B3WeChat.csproj +++ b/B3WeChat/B3WeChat.csproj @@ -132,6 +132,7 @@ + diff --git a/B3WeChat/Tasks/ClearExpiredApproveMessagesTask.cs b/B3WeChat/Tasks/ClearExpiredApproveMessagesTask.cs new file mode 100644 index 0000000..e334906 --- /dev/null +++ b/B3WeChat/Tasks/ClearExpiredApproveMessagesTask.cs @@ -0,0 +1,40 @@ +using BWP.B3WeChat.BO; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using TSingSoft.WebPluginFramework; +using TSingSoft.WebPluginFramework.TimerTasks; +using TSingSoft.WebPluginFramework; +namespace BWP.B3WeChat.Tasks +{ + public class ClearExpiredApproveMessagesTask + { + public static void Register() + { + TimerConfig.Register("0 3 * * *", new Task1()); + } + +#if DEBUG + public +#endif + class Task1 : ITimerTask + { + public void Execute() + { + var del = new DQDeleteDom(typeof(ApproveMessage)); + del.Where.Conditions.Add(DQCondition.LessThan("CreateTime", BLContext.Today.AddDays(-7))); + del.EExecute(); + } + + public string Name + { + get { return "清理过期的审批消息(7天前)"; } + } + } + + + + } +}