init
This commit is contained in:
20
service/api/internal/cmd/root.go
Normal file
20
service/api/internal/cmd/root.go
Normal file
@ -0,0 +1,20 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/robfig/cron/v3"
|
||||
"hk/service/api/internal/svc"
|
||||
)
|
||||
|
||||
var svcCtx *svc.ServiceContext
|
||||
|
||||
func Execute(ctx *svc.ServiceContext) {
|
||||
svcCtx = ctx
|
||||
c := cron.New(cron.WithSeconds())
|
||||
|
||||
ScheduleRun(c)
|
||||
fmt.Println("定时任务启动...")
|
||||
go c.Start()
|
||||
defer c.Stop()
|
||||
//select {}
|
||||
}
|
Reference in New Issue
Block a user