package v1 import ( "github.com/gogf/gf/v2/frame/g" ) // GetJobListReq 获取任务列表请求 type GetJobListReq struct { g.Meta `path:"/cron/jobs" method:"get" tags:"Cron" summary:"Get all cron jobs"` } // GetJobListRes 获取任务列表响应 type GetJobListRes struct { Jobs []*JobInfo `json:"jobs" dc:"任务列表"` } // JobInfo 任务信息 type JobInfo struct { Name string `json:"name" dc:"任务名称"` Cron string `json:"cron" dc:"Cron表达式"` Status bool `json:"status" dc:"任务状态"` NextTime string `json:"nextTime" dc:"下次执行时间"` } // AddJobReq 添加任务请求 type AddJobReq struct { g.Meta `path:"/cron/jobs" method:"post" tags:"Cron" summary:"Add a new cron job"` Name string `json:"name" v:"required" dc:"任务名称"` Cron string `json:"cron" v:"required" dc:"Cron表达式"` } // AddJobRes 添加任务响应 type AddJobRes struct { Success bool `json:"success" dc:"是否成功"` Message string `json:"message" dc:"响应消息"` } // RemoveJobReq 移除任务请求 type RemoveJobReq struct { g.Meta `path:"/cron/jobs/{name}" method:"delete" tags:"Cron" summary:"Remove a cron job"` Name string `json:"name" v:"required" dc:"任务名称"` } // RemoveJobRes 移除任务响应 type RemoveJobRes struct { Success bool `json:"success" dc:"是否成功"` Message string `json:"message" dc:"响应消息"` } // GetJobStatusReq 获取任务状态请求 type GetJobStatusReq struct { g.Meta `path:"/cron/jobs/{name}/status" method:"get" tags:"Cron" summary:"Get job status"` Name string `json:"name" v:"required" dc:"任务名称"` } // GetJobStatusRes 获取任务状态响应 type GetJobStatusRes struct { Name string `json:"name" dc:"任务名称"` Status bool `json:"status" dc:"任务状态"` }