first commit
This commit is contained in:
31
routes/cron_routes.go
Normal file
31
routes/cron_routes.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Package routes/cron_routes.go
|
||||
package routes
|
||||
|
||||
import (
|
||||
"Quincy_admin/controllers"
|
||||
"Quincy_admin/crontask"
|
||||
"Quincy_admin/middle"
|
||||
"Quincy_admin/repositories"
|
||||
"Quincy_admin/services"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
func SetupCronRoutes(router *gin.RouterGroup, db *sqlx.DB, cronManager *crontask.CronManager, m *middle.AuthMiddleware) {
|
||||
// 初始化定时任务模块依赖
|
||||
cronRepo := repositories.NewCronRepository(db)
|
||||
cronService := services.NewCronService(cronRepo, cronManager)
|
||||
cronController := controllers.NewCronController(cronService)
|
||||
|
||||
cron := router.Group("/cron")
|
||||
{
|
||||
cron.POST("/list", m.Auth(), cronController.GetCronList)
|
||||
cron.POST("/hand", m.Auth(), cronController.HandleCron)
|
||||
cron.PUT("/:id", m.Auth(), cronController.StopOrStartCron)
|
||||
cron.DELETE("/:id", m.Auth(), cronController.DeleteCron)
|
||||
cron.GET("/restart", m.Auth(), cronController.RestartCron)
|
||||
cron.GET("/stop", m.Auth(), cronController.StopCron)
|
||||
cron.POST("/loglist", m.Auth(), cronController.GetCronLogList)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user