mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-05-11 14:22:08 +08:00
优化功能,通知功能,任务功能
This commit is contained in:
@@ -9,26 +9,24 @@ import (
|
||||
// 字典 key 可以配置到 自动任务 调用目标 中;
|
||||
func InitJob() {
|
||||
jobList = map[string]JobsExec{
|
||||
"ExamplesOne": ExamplesOne{},
|
||||
"cronHandle": CronHandle{},
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
// 新添加的job 必须按照以下格式定义,并实现Exec函数
|
||||
type ExamplesOne struct {
|
||||
type CronHandle struct {
|
||||
}
|
||||
|
||||
func (t ExamplesOne) Exec(arg interface{}) error {
|
||||
func (t CronHandle) Exec(arg interface{}) error {
|
||||
str := time.Now().Format(timeFormat) + " [INFO] JobCore ExamplesOne exec success"
|
||||
// TODO: 这里需要注意 Examples 传入参数是 string 所以 arg.(string);请根据对应的类型进行转化;
|
||||
switch arg.(type) {
|
||||
|
||||
case string:
|
||||
if arg.(string) != "" {
|
||||
fmt.Println("string", arg.(string))
|
||||
fmt.Println(str, arg.(string))
|
||||
} else {
|
||||
fmt.Println("arg is nil")
|
||||
fmt.Println(str, "arg is nil")
|
||||
}
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user