- 可以设定定时开启、固定间隔开启或计划时间自动开启关闭的任务
请求方式: GET(查询) POST(新增) DELETE(批量删除)
请求地址: /api/job/schedule/
Content-Type:
新增数据的时候需要指定Content-Type,以下对Content-Type进行说明: application/x-www-form-urlencoded —— 表示通过表单方式提交 application/json —— 表示传入数据为json格式字符串
查询参数:
参数 | 数据类型 | 是否必须 | 说明 |
offset | int | 否 | 数据起始位置 |
limit | int | 否 | 查询条数 |
template | string | 否 | 模版id |
template_name | string | 否 | 模版名称 |
search | string | 否 | 模糊查询,查询字段为name |
输入参数(新增):
参数 | 数据类型 | 是否必须 | 说明 |
name | string | 是 | 计划任务名称 |
template | int | 是 | 模版id |
template_name | string | 是 | 模版名称(只读) |
type | string | 是 | 执行方式(cron-计划任务;interval-固定间隔;date-特定时间执行一次) |
type_name | string | 是 | 执行方式中文名(只读) |
start_time | long | 是 | 开始时间(秒级时间戳) |
minute | string | 否 | 分 |
hour | string | 否 | 时 |
day | string | 否 | 天 |
week | string | 否 | 周 |
month | string | 否 | 月 |
interval_type | string | 是 | 间隔类型(seconds-秒;minutes-分钟;hours-小时;days-天;weeks-周) |
interval_type_name | string | 是 | 间隔类型中文名(只读) |
interval | int | 是 | 间隔时间 |
end_time | long | 否 | 结束时间(秒级时间戳) |
last_time | long | 否 | 最后执行时间(秒级时间戳,只读) |
next_time | long | 否 | 下次执行时间(秒级时间戳,只读) |
cuser | string | 是 | 用户名(只读) |
输出参数:
参数 | 数据类型 | 是否必须 | 说明 |
id | int | 是 | 计划任务 id |
name | string | 是 | 计划任务名称 |
template | int | 是 | 模版id |
template_name | string | 是 | 模版名称(只读) |
type | string | 是 | 执行方式(cron-计划任务;interval-固定间隔;date-特定时间执行一次) |
type_name | string | 是 | 执行方式中文名(只读) |
start_time | long | 是 | 开始时间(秒级时间戳) |
minute | string | 否 | 分 |
hour | string | 否 | 时 |
day | string | 否 | 天 |
week | string | 否 | 周 |
month | string | 否 | 月 |
interval_type | string | 是 | 间隔类型(seconds-秒;minutes-分钟;hours-小时;days-天;weeks-周) |
interval_type_name | string | 是 | 间隔类型中文名(只读) |
interval | int | 是 | 间隔时间 |
end_time | long | 否 | 结束时间(秒级时间戳) |
last_time | long | 否 | 最后执行时间(秒级时间戳,只读) |
next_time | long | 否 | 下次执行时间(秒级时间戳,只读) |
cuser | string | 是 | 用户名(只读) |
批量删除参数:
参数 | 数据类型 | 是否必须 | 说明 |
pk | string | 与pk[]不能都为空 | 主键,多个主键用半角逗号隔开。通过http body传入 |
pk[] | array | 与pk不能都为空 | 主键数组。通过http body传入 |
排序:
参数 | 数据类型 | 是否必须 | 说明 |
ordering | string | 否 | 一般默认按id倒叙
|
GET返回数据例子:
{ "count": 1, "next": null, "previous": null, "results": [ { "id": 13, "name": "测试计划任务", "template_name": "workflow", "type": "cron", "type_name": "计划任务", "start_time": 1561708948, "minute": "", "hour": "", "day": "3", "week": "", "month": "", "interval": 10, "interval_type_name": "秒", "interval_type": "seconds", "end_time": 1562410228, "template": 26, "cron": "* * 3 * *", "cuser": 48, "last_time": 1561708976, "next_time": 1562112000 } ] }
新增计划任务返回数据例子:
{ "id": 13, "name": "测试计划任务", "template_name": "workflow", "type": "cron", "type_name": "计划任务", "start_time": 1561708948, "minute": "", "hour": "", "day": "3", "week": "", "month": "", "interval": 10, "interval_type_name": "秒", "interval_type": "seconds", "end_time": 1562410228, "template": 26, "cron": "* * 3 * *", "cuser": 48, "last_time": 1561708976, "next_time": 1562112000 }
请求方式: GET(查询) PUT(修改) PATCH(修改) DELETE(删除)
请求地址: /api/job/schedule/13/
请求地址中13为计划任务的id
输入/输出参数: 见章节1中输入和输出参数说明,修改数据时输入参数均为非必须
返回数据例子:
{ "id": 13, "name": "测试计划任务", "template_name": "workflow", "type": "cron", "type_name": "计划任务", "start_time": 1561708948, "minute": "", "hour": "", "day": "3", "week": "", "month": "", "interval": 10, "interval_type_name": "秒", "interval_type": "seconds", "end_time": 1562410228, "template": 26, "cron": "* * 3 * *", "cuser": 48, "last_time": 1561708976, "next_time": 1562112000 }