package jobs import ( "IotAdmin/core/logger" "time" ) // ExamplesOne // 新添加的job 必须按照以下格式定义,并实现Exec函数 type ExamplesOne struct { } func (t *ExamplesOne) Exec(arg interface{}) error { logger.Info(time.Now().Format(timeFormat) + " [INFO] JobCore ExamplesOne exec START") // TODO: 这里需要注意 Examples 传入参数是 string 所以 arg.(string);请根据对应的类型进行转化; switch arg.(type) { case string: if arg.(string) != "" { } else { logger.Errorf(time.Now().Format(timeFormat) + " [ERROR] JobCore ExamplesOne exec error: arg is empty") } break case int: break } return nil } func (t *ExamplesOne) GetName() string { return "函数测试" }