From f5afbaf39d6f3307e5a7516297aac611cad8443b Mon Sep 17 00:00:00 2001 From: yashen Date: Wed, 14 Dec 2016 13:52:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E8=BF=87=E6=9C=9F=E7=9A=84?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3WeChat.Web/PluginClass.cs | 2 + B3WeChat/B3WeChat.csproj | 1 + .../Tasks/ClearExpiredApproveMessagesTask.cs | 40 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 B3WeChat/Tasks/ClearExpiredApproveMessagesTask.cs 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天前)"; } + } + } + + + + } +}