task_router.go
1.2 KB
package routers
import (
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/web/beego/filters"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/controllers"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)
func init() {
//绩效管理模块
taskAdminNS := web.NewNamespace("/v1/admin/task",
web.NSBefore(filters.AllowCors(), middlewares.CheckAdminToken()),
web.NSCtrlPost("/info", (*controllers.TaskController).GetTaskInfo),
web.NSCtrlPut("/", (*controllers.TaskController).UpdateTask),
web.NSCtrlPost("/run", (*controllers.TaskController).RunTask),
web.NSCtrlPost("/stop", (*controllers.TaskController).StopTask),
web.NSCtrlPost("/list", (*controllers.TaskController).ListTask),
)
web.AddNamespace(taskAdminNS)
taskFontNS := web.NewNamespace("/v1/font/task",
web.NSBefore(filters.AllowCors(), middlewares.CheckFontToken()),
web.NSCtrlPost("/attention/cancel", (*controllers.TaskController).CancelAttention),
web.NSCtrlPost("/list", (*controllers.TaskController).ListTask), //TODO
)
web.AddNamespace(taskFontNS)
t := web.NewNamespace("/test/task",
web.NSCtrlPost("/", (*controllers.TaskController).CreateTask),
)
web.AddNamespace(t)
}