From db163034c036a1d052b862bfd79916f74484f48e Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 10 Jun 2026 19:27:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.example.yaml | 3 - docs/docs.go | 363 ++++++++++++++ docs/swagger.json | 363 ++++++++++++++ docs/swagger.yaml | 225 +++++++++ .../(main)/admin/tasks/executions/page.tsx | 8 - frontend/app/(main)/admin/tasks/page.tsx | 56 ++- .../common/admin/task-executions.tsx | 17 +- .../admin/{tasks.tsx => task-manager.tsx} | 17 +- .../common/admin/task-schedules.tsx | 464 ++++++++++++++++++ frontend/lib/services/admin/admin.service.ts | 33 ++ frontend/lib/services/admin/index.ts | 3 + frontend/lib/services/admin/types.ts | 36 ++ frontend/lib/services/index.ts | 3 + internal/apps/admin/task/errs.go | 22 +- internal/apps/admin/task/routers.go | 218 ++++++++ internal/config/config.go | 8 - internal/config/model.go | 1 - .../202606100001_create_schedules.sql | 20 + .../sqlite/202606100001_create_schedules.sql | 20 + internal/model/schedule.go | 72 +++ internal/router/router.go | 6 + internal/task/constants.go | 10 + internal/task/executor.go | 98 ++-- internal/task/scheduler/scheduler.go | 128 +++-- 24 files changed, 2063 insertions(+), 131 deletions(-) delete mode 100644 frontend/app/(main)/admin/tasks/executions/page.tsx rename frontend/components/common/admin/{tasks.tsx => task-manager.tsx} (96%) create mode 100644 frontend/components/common/admin/task-schedules.tsx create mode 100644 internal/db/migrator/goose/postgres/202606100001_create_schedules.sql create mode 100644 internal/db/migrator/goose/sqlite/202606100001_create_schedules.sql create mode 100644 internal/model/schedule.go diff --git a/config.example.yaml b/config.example.yaml index c1db088e..5eca688d 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -93,9 +93,6 @@ log: max_backups: 10 compress: true -# ─── Task Scheduler (Cron) ────────────────────────────────────────────────────── -scheduler: - cleanup_unused_uploads_task_cron: "0 */2 * * *" # Clean up orphaned upload records # ─── Async Task Worker ────────────────────────────────────────────────────────── worker: diff --git a/docs/docs.go b/docs/docs.go index 7cd931ee..c3062316 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1659,6 +1659,287 @@ const docTemplate = `{ } } }, + "/api/v1/admin/tasks/schedules": { + "get": { + "security": [ + { + "SessionCookie": [] + } + ], + "description": "返回系统所有的定时任务配置列表,包括名称、关联的异步任务类型、Cron 表达式和启用状态,需要管理员权限", + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "获取定时任务列表", + "responses": { + "200": { + "description": "定时任务列表", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseAny" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Schedule" + } + } + } + } + ] + } + }, + "401": { + "description": "未登录", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "403": { + "description": "无管理员权限", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + } + } + }, + "post": { + "security": [ + { + "SessionCookie": [] + } + ], + "description": "新增一个动态定时任务配置,关联已有的异步任务,配置 Cron 表达式和执行参数,并触发调度器热加载,需要管理员权限", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "创建定时任务", + "parameters": [ + { + "description": "创建定时任务请求参数", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/task.CreateScheduleRequest" + } + } + ], + "responses": { + "200": { + "description": "创建成功的定时任务信息", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseAny" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/model.Schedule" + } + } + } + ] + } + }, + "400": { + "description": "Cron 表达式无效、异步任务类型不存在或参数错误", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "401": { + "description": "未登录", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "403": { + "description": "无管理员权限", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "500": { + "description": "保存定时任务失败", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + } + } + } + }, + "/api/v1/admin/tasks/schedules/{id}": { + "put": { + "security": [ + { + "SessionCookie": [] + } + ], + "description": "修改一个定时任务的配置(名称、Cron 表达式、异步任务参数和是否启用等),并触发调度器热加载,需要管理员权限", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "修改定时任务", + "parameters": [ + { + "type": "integer", + "description": "定时任务 ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "修改定时任务请求参数", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/task.UpdateScheduleRequest" + } + } + ], + "responses": { + "200": { + "description": "修改后的定时任务信息", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseAny" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/model.Schedule" + } + } + } + ] + } + }, + "400": { + "description": "Cron 表达式无效、参数错误", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "401": { + "description": "未登录", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "403": { + "description": "无管理员权限", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "404": { + "description": "定时任务不存在", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "500": { + "description": "修改定时任务失败", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + } + } + }, + "delete": { + "security": [ + { + "SessionCookie": [] + } + ], + "description": "删除指定的定时任务配置,并触发调度器热加载,需要管理员权限", + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "删除定时任务", + "parameters": [ + { + "type": "integer", + "description": "定时任务 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "删除结果", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseAny" + }, + { + "type": "object", + "properties": { + "data": { + "type": "string" + } + } + } + ] + } + }, + "400": { + "description": "参数错误", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "401": { + "description": "未登录", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "403": { + "description": "无管理员权限", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "500": { + "description": "删除定时任务失败", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + } + } + } + }, "/api/v1/admin/tasks/types": { "get": { "security": [ @@ -4362,6 +4643,36 @@ const docTemplate = `{ } } }, + "model.Schedule": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "cron": { + "type": "string" + }, + "id": { + "type": "string", + "example": "0" + }, + "is_active": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "payload": { + "type": "string" + }, + "task_type": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, "model.SystemConfig": { "type": "object", "properties": { @@ -4933,6 +5244,32 @@ const docTemplate = `{ } } }, + "task.CreateScheduleRequest": { + "type": "object", + "required": [ + "cron", + "is_active", + "name", + "task_type" + ], + "properties": { + "cron": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "payload": { + "type": "string" + }, + "task_type": { + "type": "string" + } + } + }, "task.DispatchTaskRequest": { "type": "object", "required": [ @@ -5021,6 +5358,32 @@ const docTemplate = `{ } } }, + "task.UpdateScheduleRequest": { + "type": "object", + "required": [ + "cron", + "is_active", + "name", + "task_type" + ], + "properties": { + "cron": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "payload": { + "type": "string" + }, + "task_type": { + "type": "string" + } + } + }, "template.CreateTemplateRequest": { "type": "object", "required": [ diff --git a/docs/swagger.json b/docs/swagger.json index 5d37ed68..44f4bccc 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1652,6 +1652,287 @@ } } }, + "/api/v1/admin/tasks/schedules": { + "get": { + "security": [ + { + "SessionCookie": [] + } + ], + "description": "返回系统所有的定时任务配置列表,包括名称、关联的异步任务类型、Cron 表达式和启用状态,需要管理员权限", + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "获取定时任务列表", + "responses": { + "200": { + "description": "定时任务列表", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseAny" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Schedule" + } + } + } + } + ] + } + }, + "401": { + "description": "未登录", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "403": { + "description": "无管理员权限", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + } + } + }, + "post": { + "security": [ + { + "SessionCookie": [] + } + ], + "description": "新增一个动态定时任务配置,关联已有的异步任务,配置 Cron 表达式和执行参数,并触发调度器热加载,需要管理员权限", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "创建定时任务", + "parameters": [ + { + "description": "创建定时任务请求参数", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/task.CreateScheduleRequest" + } + } + ], + "responses": { + "200": { + "description": "创建成功的定时任务信息", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseAny" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/model.Schedule" + } + } + } + ] + } + }, + "400": { + "description": "Cron 表达式无效、异步任务类型不存在或参数错误", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "401": { + "description": "未登录", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "403": { + "description": "无管理员权限", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "500": { + "description": "保存定时任务失败", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + } + } + } + }, + "/api/v1/admin/tasks/schedules/{id}": { + "put": { + "security": [ + { + "SessionCookie": [] + } + ], + "description": "修改一个定时任务的配置(名称、Cron 表达式、异步任务参数和是否启用等),并触发调度器热加载,需要管理员权限", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "修改定时任务", + "parameters": [ + { + "type": "integer", + "description": "定时任务 ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "修改定时任务请求参数", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/task.UpdateScheduleRequest" + } + } + ], + "responses": { + "200": { + "description": "修改后的定时任务信息", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseAny" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/model.Schedule" + } + } + } + ] + } + }, + "400": { + "description": "Cron 表达式无效、参数错误", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "401": { + "description": "未登录", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "403": { + "description": "无管理员权限", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "404": { + "description": "定时任务不存在", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "500": { + "description": "修改定时任务失败", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + } + } + }, + "delete": { + "security": [ + { + "SessionCookie": [] + } + ], + "description": "删除指定的定时任务配置,并触发调度器热加载,需要管理员权限", + "produces": [ + "application/json" + ], + "tags": [ + "admin" + ], + "summary": "删除定时任务", + "parameters": [ + { + "type": "integer", + "description": "定时任务 ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "删除结果", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/util.ResponseAny" + }, + { + "type": "object", + "properties": { + "data": { + "type": "string" + } + } + } + ] + } + }, + "400": { + "description": "参数错误", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "401": { + "description": "未登录", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "403": { + "description": "无管理员权限", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + }, + "500": { + "description": "删除定时任务失败", + "schema": { + "$ref": "#/definitions/util.ResponseAny" + } + } + } + } + }, "/api/v1/admin/tasks/types": { "get": { "security": [ @@ -4355,6 +4636,36 @@ } } }, + "model.Schedule": { + "type": "object", + "properties": { + "created_at": { + "type": "string" + }, + "cron": { + "type": "string" + }, + "id": { + "type": "string", + "example": "0" + }, + "is_active": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "payload": { + "type": "string" + }, + "task_type": { + "type": "string" + }, + "updated_at": { + "type": "string" + } + } + }, "model.SystemConfig": { "type": "object", "properties": { @@ -4926,6 +5237,32 @@ } } }, + "task.CreateScheduleRequest": { + "type": "object", + "required": [ + "cron", + "is_active", + "name", + "task_type" + ], + "properties": { + "cron": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "payload": { + "type": "string" + }, + "task_type": { + "type": "string" + } + } + }, "task.DispatchTaskRequest": { "type": "object", "required": [ @@ -5014,6 +5351,32 @@ } } }, + "task.UpdateScheduleRequest": { + "type": "object", + "required": [ + "cron", + "is_active", + "name", + "task_type" + ], + "properties": { + "cron": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "payload": { + "type": "string" + }, + "task_type": { + "type": "string" + } + } + }, "template.CreateTemplateRequest": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 57f4e7ca..8c318880 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -277,6 +277,26 @@ definitions: id: type: integer type: object + model.Schedule: + properties: + created_at: + type: string + cron: + type: string + id: + example: "0" + type: string + is_active: + type: boolean + name: + type: string + payload: + type: string + task_type: + type: string + updated_at: + type: string + type: object model.SystemConfig: properties: created_at: @@ -667,6 +687,24 @@ definitions: required: - value type: object + task.CreateScheduleRequest: + properties: + cron: + type: string + is_active: + type: boolean + name: + type: string + payload: + type: string + task_type: + type: string + required: + - cron + - is_active + - name + - task_type + type: object task.DispatchTaskRequest: properties: end_time: @@ -727,6 +765,24 @@ definitions: description: 类型:string, text, number type: string type: object + task.UpdateScheduleRequest: + properties: + cron: + type: string + is_active: + type: boolean + name: + type: string + payload: + type: string + task_type: + type: string + required: + - cron + - is_active + - name + - task_type + type: object template.CreateTemplateRequest: properties: content: @@ -1941,6 +1997,175 @@ paths: summary: 重试失败任务 tags: - admin + /api/v1/admin/tasks/schedules: + get: + description: 返回系统所有的定时任务配置列表,包括名称、关联的异步任务类型、Cron 表达式和启用状态,需要管理员权限 + produces: + - application/json + responses: + "200": + description: 定时任务列表 + schema: + allOf: + - $ref: '#/definitions/util.ResponseAny' + - properties: + data: + items: + $ref: '#/definitions/model.Schedule' + type: array + type: object + "401": + description: 未登录 + schema: + $ref: '#/definitions/util.ResponseAny' + "403": + description: 无管理员权限 + schema: + $ref: '#/definitions/util.ResponseAny' + security: + - SessionCookie: [] + summary: 获取定时任务列表 + tags: + - admin + post: + consumes: + - application/json + description: 新增一个动态定时任务配置,关联已有的异步任务,配置 Cron 表达式和执行参数,并触发调度器热加载,需要管理员权限 + parameters: + - description: 创建定时任务请求参数 + in: body + name: request + required: true + schema: + $ref: '#/definitions/task.CreateScheduleRequest' + produces: + - application/json + responses: + "200": + description: 创建成功的定时任务信息 + schema: + allOf: + - $ref: '#/definitions/util.ResponseAny' + - properties: + data: + $ref: '#/definitions/model.Schedule' + type: object + "400": + description: Cron 表达式无效、异步任务类型不存在或参数错误 + schema: + $ref: '#/definitions/util.ResponseAny' + "401": + description: 未登录 + schema: + $ref: '#/definitions/util.ResponseAny' + "403": + description: 无管理员权限 + schema: + $ref: '#/definitions/util.ResponseAny' + "500": + description: 保存定时任务失败 + schema: + $ref: '#/definitions/util.ResponseAny' + security: + - SessionCookie: [] + summary: 创建定时任务 + tags: + - admin + /api/v1/admin/tasks/schedules/{id}: + delete: + description: 删除指定的定时任务配置,并触发调度器热加载,需要管理员权限 + parameters: + - description: 定时任务 ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: 删除结果 + schema: + allOf: + - $ref: '#/definitions/util.ResponseAny' + - properties: + data: + type: string + type: object + "400": + description: 参数错误 + schema: + $ref: '#/definitions/util.ResponseAny' + "401": + description: 未登录 + schema: + $ref: '#/definitions/util.ResponseAny' + "403": + description: 无管理员权限 + schema: + $ref: '#/definitions/util.ResponseAny' + "500": + description: 删除定时任务失败 + schema: + $ref: '#/definitions/util.ResponseAny' + security: + - SessionCookie: [] + summary: 删除定时任务 + tags: + - admin + put: + consumes: + - application/json + description: 修改一个定时任务的配置(名称、Cron 表达式、异步任务参数和是否启用等),并触发调度器热加载,需要管理员权限 + parameters: + - description: 定时任务 ID + in: path + name: id + required: true + type: integer + - description: 修改定时任务请求参数 + in: body + name: request + required: true + schema: + $ref: '#/definitions/task.UpdateScheduleRequest' + produces: + - application/json + responses: + "200": + description: 修改后的定时任务信息 + schema: + allOf: + - $ref: '#/definitions/util.ResponseAny' + - properties: + data: + $ref: '#/definitions/model.Schedule' + type: object + "400": + description: Cron 表达式无效、参数错误 + schema: + $ref: '#/definitions/util.ResponseAny' + "401": + description: 未登录 + schema: + $ref: '#/definitions/util.ResponseAny' + "403": + description: 无管理员权限 + schema: + $ref: '#/definitions/util.ResponseAny' + "404": + description: 定时任务不存在 + schema: + $ref: '#/definitions/util.ResponseAny' + "500": + description: 修改定时任务失败 + schema: + $ref: '#/definitions/util.ResponseAny' + security: + - SessionCookie: [] + summary: 修改定时任务 + tags: + - admin /api/v1/admin/tasks/types: get: description: 返回系统支持的所有可调度任务类型列表,包括任务名称、描述、是否支持时间范围等元数据,需要管理员权限 diff --git a/frontend/app/(main)/admin/tasks/executions/page.tsx b/frontend/app/(main)/admin/tasks/executions/page.tsx deleted file mode 100644 index 9bd5f49e..00000000 --- a/frontend/app/(main)/admin/tasks/executions/page.tsx +++ /dev/null @@ -1,8 +0,0 @@ -"use client" - -import {TaskExecutionsManager} from "@/components/common/admin/task-executions" - -/* 任务日志页面 */ -export default function TaskExecutionsPage() { - return -} diff --git a/frontend/app/(main)/admin/tasks/page.tsx b/frontend/app/(main)/admin/tasks/page.tsx index 39e329a5..e5ab7d61 100644 --- a/frontend/app/(main)/admin/tasks/page.tsx +++ b/frontend/app/(main)/admin/tasks/page.tsx @@ -1,8 +1,56 @@ "use client" -import { TaskManager } from "@/components/common/admin/tasks" +import {Suspense} from "react" +import {useRouter, useSearchParams} from "next/navigation" +import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs" +import {TaskManager} from "@/components/common/admin/task-manager" +import {TaskSchedulesManager} from "@/components/common/admin/task-schedules" +import {TaskExecutionsManager} from "@/components/common/admin/task-executions" +import {Spinner} from "@/components/ui/spinner" -/* 任务管理页面 */ -export default function TasksPage() { - return +function TasksPageContent() { + const searchParams = useSearchParams() + const router = useRouter() + const activeTab = searchParams.get("tab") || "tasks" + + const handleTabChange = (value: string) => { + router.push(`/admin/tasks?tab=${value}`) + } + + return ( +
+
+

任务管理

+
+ + + + 任务管理 + 定时任务 + 任务日志 + + + + + + + + + + + +
+ ) +} + +export default function TasksPage() { + return ( + + + + }> + + + ) } diff --git a/frontend/components/common/admin/task-executions.tsx b/frontend/components/common/admin/task-executions.tsx index a7e5597e..100208ec 100644 --- a/frontend/components/common/admin/task-executions.tsx +++ b/frontend/components/common/admin/task-executions.tsx @@ -1,7 +1,6 @@ "use client" import {useCallback, useEffect, useState} from "react" -import Link from "next/link" import {toast} from "sonner" import {format} from "date-fns" import {Activity, ChevronLeft, ChevronRight, RefreshCw, RotateCcw} from "lucide-react" @@ -29,6 +28,7 @@ const TRIGGER_LABELS: Record = { system: "系统", manual: "手动", retry: "重试", + schedule: "定时", } function formatDateTime(value?: string | null) { @@ -148,21 +148,10 @@ export function TaskExecutionsManager() { const totalPages = Math.max(1, Math.ceil(executionsTotal / 10)) return ( -
+
+
-
- -
-
任务日志
-
查看异步任务执行状况,点击任务记录查看详情
-
-
- setName(e.target.value)} + className="text-xs" + /> +
+ +
+ + +
+ +
+ + setCron(e.target.value)} + className="text-xs font-mono" + /> +

使用标准 5 位 Cron 字段格式(分钟、小时、日期、月份、星期几)。

+
+ +
+
+ +

决定此定时任务是否会定时触发执行。

+
+ +
+ + {(() => { + const targetTask = getSelectedTaskMeta() + if (!targetTask || !targetTask.params || targetTask.params.length === 0) { + return ( +
+ + 所选任务类型不需要运行参数参数。 +
+ ) + } + return ( +
+ + {targetTask.params.map((param) => ( +
+ + {param.type === 'text' ? ( +