签入脚本
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package task
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
"easygoadmin/internal/logic"
|
||||
)
|
||||
|
||||
func init() {
|
||||
logic.RegisterJobHandler("HelloWorld", helloWorld)
|
||||
}
|
||||
|
||||
// helloWorld 示例任务
|
||||
// 仅打印日志,用于验证调度链路
|
||||
func helloWorld(ctx context.Context, params string) (string, error) {
|
||||
now := time.Now().Format("2006-01-02 15:04:05")
|
||||
g.Log().Infof(ctx, "[定时任务] HelloWorld 执行,时间: %s,参数: %s", now, paramsText(params))
|
||||
return fmt.Sprintf("Hello World! 时间: %s | 参数: %s", now, paramsText(params)), nil
|
||||
}
|
||||
Reference in New Issue
Block a user