mirror of
https://github.com/tiger1103/gfast.git
synced 2026-09-21 18:20:47 +00:00
feat: 🎨 任务立即执行
This commit is contained in:
@@ -10,6 +10,7 @@ package api
|
||||
import (
|
||||
"gfast/app/system/dao"
|
||||
"gfast/app/system/service"
|
||||
|
||||
"github.com/gogf/gf/frame/g"
|
||||
"github.com/gogf/gf/net/ghttp"
|
||||
"github.com/gogf/gf/util/gvalid"
|
||||
@@ -105,6 +106,20 @@ func (c *sysJob) Stop(r *ghttp.Request) {
|
||||
c.SusJsonExit(r, "定时任务管理停止成功")
|
||||
}
|
||||
|
||||
// Run 执行任务
|
||||
func (c *sysJob) Run(r *ghttp.Request) {
|
||||
id := r.GetInt64("id")
|
||||
job, err := service.SysJob.GetJobInfoById(id)
|
||||
if err != nil {
|
||||
c.FailJsonExit(r, err.Error())
|
||||
}
|
||||
err = service.SysJob.JobRun(job)
|
||||
if err != nil {
|
||||
c.FailJsonExit(r, "定时任务管理执行"+err.Error())
|
||||
}
|
||||
c.SusJsonExit(r, "定时任务管理执行成功")
|
||||
}
|
||||
|
||||
// Delete 删除任务
|
||||
func (c *sysJob) Delete(r *ghttp.Request) {
|
||||
ids := r.GetInts("ids")
|
||||
|
||||
Reference in New Issue
Block a user