提交
This commit is contained in:
33
modules/task/task.go
Normal file
33
modules/task/task.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package demo
|
||||
|
||||
import (
|
||||
_ "github.com/cool-team-official/cool-admin-go/modules/task/packed"
|
||||
|
||||
"github.com/cool-team-official/cool-admin-go/cool"
|
||||
_ "github.com/cool-team-official/cool-admin-go/modules/task/controller"
|
||||
_ "github.com/cool-team-official/cool-admin-go/modules/task/funcs"
|
||||
_ "github.com/cool-team-official/cool-admin-go/modules/task/middleware"
|
||||
"github.com/cool-team-official/cool-admin-go/modules/task/model"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
)
|
||||
|
||||
func init() {
|
||||
var (
|
||||
taskInfo = model.NewTaskInfo()
|
||||
ctx = gctx.GetInitCtx()
|
||||
)
|
||||
g.Log().Debug(ctx, "module task init start ...")
|
||||
cool.FillInitData(ctx, "task", taskInfo)
|
||||
|
||||
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+")")
|
||||
}
|
||||
g.Log().Debug(ctx, "module task init finished ...")
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user