main.go
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"github.com/astaxie/beego"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/application/notification/service"
_ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg"
_ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/port/beego"
"time"
)
func main() {
go func() {
notificationService := service.NewNotificationService(nil)
for {
now := time.Now()
next := now.Add(time.Hour * 24)
//next := now.Add(time.Minute * 5)
nextZero := time.Date(next.Year(), next.Month(), next.Day(), 0, 0, 0, 0, next.Location())
dispatchTicker := time.NewTimer(nextZero.Sub(now))
<-dispatchTicker.C
if _, err := notificationService.SystemNotificationNearThePlannedCompletionTimeTaskReceiver(); err != nil {
println(err.Error())
}
}
}()
go func() {
notificationService := service.NewNotificationService(nil)
for {
now := time.Now()
next := now.Add(time.Hour * 24)
nextZero := time.Date(next.Year(), next.Month(), next.Day(), 0, 0, 0, 0, next.Location())
dispatchTicker := time.NewTimer(nextZero.Sub(now))
<-dispatchTicker.C
if _, err := notificationService.SystemNotificationNearBidEndTimeTaskSponsor(); err != nil {
println(err.Error())
}
}
}()
// excel文件路径映射
beego.SetStaticPath("/download", "download")
beego.Run()
}