38 lines
500 B
Go
38 lines
500 B
Go
package contracts
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/samber/do"
|
|
)
|
|
|
|
type JobServer interface {
|
|
Start() error
|
|
Stop() error
|
|
Restart() error
|
|
}
|
|
|
|
type JobService interface {
|
|
Dispatch(job string, payload any, u User) error
|
|
}
|
|
|
|
type Job interface {
|
|
Controller
|
|
// 任务处理
|
|
Handle(any) error
|
|
}
|
|
|
|
type JobBase struct {
|
|
Controller
|
|
}
|
|
|
|
func (JobBase) Handle(any) error {
|
|
return fmt.Errorf("")
|
|
}
|
|
|
|
func NewJobBase(container *do.Injector) Job {
|
|
return &JobBase{
|
|
Controller: &BaseController{container},
|
|
}
|
|
}
|