Files
bl/modules/task/funcs/task_stop_func.go

36 lines
601 B
Go
Raw Normal View History

2025-06-20 17:13:51 +08:00
package funcs
import (
"blazing/cool"
"blazing/modules/task/model"
"blazing/modules/task/service"
2025-06-20 17:13:51 +08:00
"github.com/gogf/gf/v2/frame/g"
)
type TaskStopFunc struct {
}
func (t *TaskStopFunc) Func(ctx g.Ctx, id string) error {
taskInfo := model.NewTaskInfo()
_, err := cool.DBM(taskInfo).Where("id = ?", id).Update(g.Map{"status": 0})
if err != nil {
return err
}
return service.DisableTask(ctx, id)
}
func (t *TaskStopFunc) IsSingleton() bool {
return false
}
func (t *TaskStopFunc) IsAllWorker() bool {
return true
}
func init() {
cool.RegisterFunc("TaskStopFunc", &TaskStopFunc{})
}