Browse Source

还原定时任务

boweniac 1 week ago
parent
commit
e2f229e368
1 changed files with 19 additions and 19 deletions
  1. 19 19
      crontask/init.go

+ 19 - 19
crontask/init.go

@@ -23,25 +23,25 @@ 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()
+	})
+
+	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("* * * * *", func() {