12345678910111213141516171819202122232425262728293031323334353637 |
- package init_serve
- import (
- "eta/eta_bridge/global"
- "eta/eta_bridge/services"
- "eta/eta_bridge/services/index_data"
- "github.com/robfig/cron/v3"
- )
- func InitTask() {
-
-
- if global.CONFIG.Serve.IsStopTask {
- return
- }
-
- go services.ListenSyncRole()
- go services.ListenSyncAdmin()
- go services.ListenSyncDepartment()
- go services.ListenSyncGroup()
- go services.ListenSyncUserEnRole()
-
- c := cron.New(cron.WithSeconds())
-
- if global.CONFIG.Mysql.Binlog.IsListen {
- _, err := c.AddFunc("0 0 0 * * *", index_data.DeleteBeforeTenDayLog)
- if err != nil {
- global.LOG.Error("DeleteBeforeTenDayLog err" + err.Error())
- }
- }
- c.Start()
- }
|