package demo

import (
	_ "blazing/modules/task/packed"

	"blazing/cool"

	_ "blazing/modules/task/controller"
	_ "blazing/modules/task/funcs"
	_ "blazing/modules/task/middleware"
	"blazing/modules/task/model"

	"github.com/gogf/gf/v2/os/gctx"
)

func init() {
	var (
		taskInfo = model.NewTaskInfo()
		ctx      = gctx.GetInitCtx()
	)
	cool.Loger.Debug(ctx, "module task init start ...")
	cool.FillInitData(ctx, "task", taskInfo, nil)

	result, err := cool.DBM(taskInfo).Where("status", 1).All()
	if err != nil {
		panic(err)
	}
	for _, v := range result {
		id := v["id"].String()
		cool.RunFunc(ctx, "TaskAddTask("+id+")")
	}
	cool.Loger.Debug(ctx, "module task init finished ...")

}
