package db import ( "applet/app/db/model" "applet/app/utils/logx" _ "github.com/go-sql-driver/mysql" "xorm.io/xorm" ) // 获取自动任务队列 func MapCrontabCfg(eg *xorm.Engine) *[]model.CronTask { var c []model.CronTask // 数据库查询如果有下划线会认为是一个任意字符 if err := eg.Where("`key` LIKE 'cron\\_%' AND val != ''").Cols("`key`,`val`").Find(&c); err != nil || len(c) == 0 { logx.Warn(err) return nil } return &c }