优化结构
This commit is contained in:
@@ -299,9 +299,9 @@ const headerText = ref('')
|
||||
const methodOptions = ref([])
|
||||
const formTitle = computed(() => (form.value.ID ? '编辑定时任务' : '新增定时任务'))
|
||||
|
||||
// 注册方法代码模板: 引导二开在 worker 的统一注册入口追加注册。
|
||||
const methodRegisterTemplate = `// 位置: internal/worker/task_registry.go -> registerTaskMethods()
|
||||
biz.RegisterTaskMethod("MyTask", "任务说明(展示在方法下拉中)", func(ctx context.Context, params json.RawMessage) error {
|
||||
// 注册方法代码模板: 引导二开通过模块或 worker contributor 显式注册。
|
||||
const methodRegisterTemplate = `// 在模块 Definition.Tasks 或 TaskMethods.RegisterTasks 中注册
|
||||
registry.Register(task.Method{Name: "MyTask", Description: "任务说明(展示在方法下拉中)", Run: func(ctx context.Context, params json.RawMessage) error {
|
||||
// params 为面板「参数(JSON)」原文, 按需解析; 无参数可忽略
|
||||
// var p struct {
|
||||
// Days int \`json:"days"\`
|
||||
@@ -313,7 +313,7 @@ biz.RegisterTaskMethod("MyTask", "任务说明(展示在方法下拉中)", func(
|
||||
// }
|
||||
// TODO: 调用注入到 TaskExecutor 的 biz usecase 执行业务逻辑
|
||||
return nil
|
||||
})`
|
||||
}})`
|
||||
|
||||
const copyRegisterTemplate = () => {
|
||||
const input = document.createElement('textarea')
|
||||
@@ -322,7 +322,7 @@ const copyRegisterTemplate = () => {
|
||||
input.select()
|
||||
document.execCommand('copy')
|
||||
document.body.removeChild(input)
|
||||
ElMessage.success('已复制,请粘贴到 internal/worker/task_registry.go 的 registerTaskMethods() 中,重启后生效')
|
||||
ElMessage.success('已复制,请添加到模块任务定义或 TaskMethods.RegisterTasks,重启后生效')
|
||||
}
|
||||
|
||||
const openForm = async (row) => {
|
||||
|
||||
Reference in New Issue
Block a user