1234567891011121314151617181920212223242526272829303132333435 |
- package crontab
- import (
- "fmt"
- "go-nc/configs/global"
- "go-nc/model"
- "go-nc/pkg/sim"
- )
- // 卡任务
- // 流量任务列表
- func SimCardTask() {
- executor := NewTaskExecutor()
- // 每小时同步一次:上级流量包
- executor.c.AddFunc("0 * * * * *", func() {
- fmt.Println("同步上级流量包")
- sim.GetFlowPackage()
- })
- // 每分钟同步一次卡数据
- executor.c.AddFunc("0 * * * * *", func() {
- var iccids []string
- global.App.DB.Model(&model.Sim_card{}).Select("iccid").Find(&iccids)
- for _, v := range iccids {
- go sim.GetCardInfo("grace", v, nil)
- }
- })
- // executor.c.AddFunc("* * * * * *", func() {
- // fmt.Println("卡任务2")
- // })
- executor.Start()
- }
|