ソースを参照

恢复定时任务

boweniac 1 週間 前
コミット
28d3042b88
1 ファイル変更24 行追加24 行削除
  1. 24 24
      crontask/init.go

+ 24 - 24
crontask/init.go

@@ -24,33 +24,33 @@ func NewCronTask(ctx context.Context, svcCtx *svc.ServiceContext) *CronTask {
 
 func ScheduleRun(c *cron.Cron, serverCtx *svc.ServiceContext) {
 
-	//l := NewCronTask(context.Background(), serverCtx)
-	//c.AddFunc("* * * * *", func() {
-	//	l.sendMsg()
-	//})
-	//
-	//sendWx := NewCronTask(context.Background(), serverCtx)
-	//c.AddFunc("* * * * *", func() {
-	//	sendWx.sendWx()
-	//})
-	//
-	//sendWxOnTimeout := NewCronTask(context.Background(), serverCtx)
-	//c.AddFunc("* * * * *", func() {
-	//	sendWxOnTimeout.sendWxOnTimeout()
-	//})
-	//
-	//computeStatistic := NewCronTask(context.Background(), serverCtx)
-	//c.AddFunc("0 * * * *", func() {
-	//	computeStatistic.computeStatistic()
-	//})
+	l := NewCronTask(context.Background(), serverCtx)
+	c.AddFunc("* * * * *", func() {
+		l.sendMsg()
+	})
 
-	//syncWx := NewCronTask(context.Background(), serverCtx)
-	//c.AddFunc("*/30 * * * *", func() {
-	//	syncWx.syncWx()
-	//})
+	sendWx := NewCronTask(context.Background(), serverCtx)
+	c.AddFunc("* * * * *", func() {
+		sendWx.sendWx()
+	})
+
+	sendWxOnTimeout := NewCronTask(context.Background(), serverCtx)
+	c.AddFunc("* * * * *", func() {
+		sendWxOnTimeout.sendWxOnTimeout()
+	})
+
+	computeStatistic := NewCronTask(context.Background(), serverCtx)
+	c.AddFunc("0 * * * *", func() {
+		computeStatistic.computeStatistic()
+	})
+
+	syncWx := NewCronTask(context.Background(), serverCtx)
+	c.AddFunc("*/30 * * * *", func() {
+		syncWx.syncWx()
+	})
 
 	contactForm := NewCronTask(context.Background(), serverCtx)
-	c.AddFunc("@every 1m", func() {
+	c.AddFunc("0 0 * * *", func() {
 		contactForm.analyze()
 	})