Files
EasyGoAdmin_GoFrame_EleVue/internal/task/task.go
T
2026-10-20 11:37:25 +08:00

24 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Package task 定时任务处理器
//
// 本包存放全部定时任务的业务实现,与 HTTP 请求处理链路隔离:
// - 调度器基础设施(gcron 挂载/摘除/执行分派)在 internal/logic 的 job 模块
// - 本包仅存放各任务处理方法,文件按任务名 snake_case 平铺
//
// 约定:
// 1. 每个任务一个文件,init 中调用 logic.RegisterJobHandler 注册,
// 注册名与任务记录 url 字段值一致(数据驱动查找)
// 2. 依赖方向单向:task → logic(注册 + 共享能力),logic 不得反向依赖 task
// 3. 处理方法签名 func(ctx, params) (string, error):
// params 为任务参数(JSON 字符串,可为空),返回值写入任务日志摘要
// 4. 本包不在 HTTP 启动链路内,由 internal/cmd 空白导入触发 init 注册
package task
// paramsText 任务参数展示
// 空参数统一显示为"无参数"
func paramsText(params string) string {
if params == "" {
return "无参数"
}
return params
}