feat: Task scheduling supports function with parameters

注意:参数资源sql;
ALTER TABLE `sys_job`
ADD COLUMN `args` varchar(255) NULL COMMENT '目标参数' AFTER `invoke_target`;
This commit is contained in:
zhangwenjian committed 2020-08-20 06:30:44 +08:00
1 parent 242902d2bc
commit b26258c8ab
5 files changed
+24 -6

No files matched your search

+3 -1
View File
@@ -23,6 +23,7 @@ type JobCore struct {
JobId int
EntryId int
CronExpression string
Args string
}
// 任务类型 http
@@ -41,7 +42,7 @@ func (e *ExecJob) Run() {
global.JobLogger.Warning(" ExecJob Run job nil", e)
return
}
CallExec(obj.(JobsExec))
CallExec(obj.(JobsExec), e.Args)
// 结束时间
endTime := time.Now()
@@ -119,6 +120,7 @@ func Setup() {
j.CronExpression = jobList[i].CronExpression
j.JobId = jobList[i].JobId
j.Name = jobList[i].JobName
j.Args = jobList[i].Args
sysJob.EntryId, err = AddJob(j)
}
_, err = sysJob.Update(jobList[i].JobId)