2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 17:17:13 +08:00
Files
panel/app/services/task.go
2023-11-11 03:19:06 +08:00

32 lines
553 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().Info("[面板][TaskService] 运行任务失败: " + err.Error())
return
}
}()
}