contracts/job.go

25 lines
358 B
Go
Raw Permalink Normal View History

2023-06-05 13:37:32 +08:00
package contracts
2024-05-09 13:15:24 +08:00
import "git.fsdpf.net/go/req"
2023-06-06 10:14:16 +08:00
type JobService interface {
2023-06-05 13:37:32 +08:00
Start() error
Stop() error
Restart() error
2024-05-09 13:15:24 +08:00
Dispatch(job string, payload any, u req.User) error
2023-06-05 13:37:32 +08:00
}
2023-06-05 16:52:03 +08:00
type Job interface {
Controller
// 任务处理
2024-05-09 13:15:24 +08:00
Handle(any, req.User) error
2023-06-05 16:52:03 +08:00
}
type JobBase struct {
Controller
}
2024-05-09 13:15:24 +08:00
func (JobBase) Handle(any, req.User) error {
2023-06-05 17:32:10 +08:00
return nil
2023-06-05 16:52:03 +08:00
}