mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 20:57:19 +08:00
32 lines
554 B
Go
32 lines
554 B
Go
package services
|
|
|
|
import (
|
|
"github.com/goravel/framework/contracts/queue"
|
|
"github.com/goravel/framework/facades"
|
|
|
|
"panel/app/jobs"
|
|
)
|
|
|
|
type Task interface {
|
|
Process(taskID uint)
|
|
}
|
|
|
|
type TaskImpl struct {
|
|
}
|
|
|
|
func NewTaskImpl() *TaskImpl {
|
|
return &TaskImpl{}
|
|
}
|
|
|
|
func (r *TaskImpl) Process(taskID uint) {
|
|
go func() {
|
|
err := facades.Queue().Job(&jobs.ProcessTask{}, []queue.Arg{
|
|
{Type: "uint", Value: taskID},
|
|
}).Dispatch()
|
|
if err != nil {
|
|
facades.Log().Error("[面板][TaskService] 运行任务失败: " + err.Error())
|
|
return
|
|
}
|
|
}()
|
|
}
|