2023-06-05 13:37:32 +08:00
|
|
|
package contracts
|
|
|
|
|
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
|
|
|
|
Dispatch(job string, payload any, u User) error
|
|
|
|
}
|
2023-06-05 16:52:03 +08:00
|
|
|
|
|
|
|
type Job interface {
|
|
|
|
Controller
|
|
|
|
// 任务处理
|
2023-06-06 10:52:07 +08:00
|
|
|
Handle(any, User) error
|
2023-06-05 16:52:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type JobBase struct {
|
|
|
|
Controller
|
|
|
|
}
|
|
|
|
|
2023-06-06 10:52:07 +08:00
|
|
|
func (JobBase) Handle(any, User) error {
|
2023-06-05 17:32:10 +08:00
|
|
|
return nil
|
2023-06-05 16:52:03 +08:00
|
|
|
}
|