12345678910111213141516171819202122232425262728293031323334353637383940 |
- package main
- import (
- "context"
- //"context"
- //_ "getuser/internal/packed"
- //"github.com/gogf/gf/v2/frame/g"
- //"github.com/gogf/gf/v2/os/gcron"
- _ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
- _ "github.com/gogf/gf/contrib/drivers/mysql/v2"
- "github.com/gogf/gf/v2/frame/g"
- "github.com/gogf/gf/v2/os/gcron"
- "github.com/gogf/gf/v2/os/gctx"
- "newuserGet/internal/logic"
- )
- func main() {
- var (
- err error
- ctx = gctx.New()
- )
- //logic.Task(ctx)
- //
- taskRun := g.Cfg().MustGet(ctx, "task.taskRun").Bool()
- if taskRun {
- cronStr := g.Cfg().MustGet(ctx, "task.cron").String()
- _, err = gcron.AddSingleton(ctx, cronStr, func(ctx context.Context) {
- g.Log().Print(ctx, "doing start")
- logic.Task(ctx)
- g.Log().Print(ctx, "end")
- })
- if err != nil {
- panic(err)
- }
- }
- select {}
- }
|