mirror of https://github.com/shunfei/cronsun
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.
23 lines
352 B
23 lines
352 B
package node
|
|
|
|
import (
|
|
"sunteng/cronsun/models"
|
|
)
|
|
|
|
type Job map[string]*models.Job
|
|
|
|
func newJob(id string, g Group) (j Job, err error) {
|
|
jobs, err := models.GetJobs()
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
j = make(Job, len(jobs))
|
|
for _, job := range jobs {
|
|
if sch, _ := job.Schedule(id, g, false); len(sch) > 0 {
|
|
j[job.GetID()] = job
|
|
}
|
|
}
|
|
return
|
|
}
|