智慧食堂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

db_map.go 463 B

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