浏览代码

任务打开,非fe环境

lichangdong 1 天之前
父节点
当前提交
4fe4be0e22
共有 1 个文件被更改,包括 30 次插入30 次删除
  1. 30 30
      crontask/init.go

+ 30 - 30
crontask/init.go

@@ -24,36 +24,36 @@ 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()
-	//})
-	//
-	//contactForm := NewCronTask(context.Background(), serverCtx)
-	//c.AddFunc("10 0 * * *", func() {
-	//	contactForm.analyze()
-	//})
-	//
-	//l = NewCronTask(context.Background(), serverCtx)
-	//c.AddFunc("*/30 * * * *", func() {
-	//	l.wxAddFriend()
-	//})
+	//除了fe环境任务关闭 其他环境任务要正常打开
+	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()
+	})
+
+	contactForm := NewCronTask(context.Background(), serverCtx)
+	c.AddFunc("10 0 * * *", func() {
+		contactForm.analyze()
+	})
+
+	l = NewCronTask(context.Background(), serverCtx)
+	c.AddFunc("*/30 * * * *", func() {
+		l.wxAddFriend()
+	})
 
 	//l = NewCronTask(context.Background(), serverCtx)
 	//c.AddFunc("* * * * *", func() {