mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 10:13:01 +00:00
Every import of the module changes, not only the seven packages that
moved out of sdk/pkg: Go requires the major version in the path from v2
on. Both happen in one pass —
go run github.com/go-admin-team/go-admin-core/tools/coreupgrade@v2.0.0 -w -v2 .
go mod tidy
— which is the command the release notes give, run here as a consumer
would run it. 210 imports across 95 files.
The compatibility shims this used are gone in v2, so the paths that
moved had to move: sdk/pkg/captcha, sdk/pkg/jwtauth and its user
package, sdk/pkg/response and sdk/pkg/casbin.
The count of unformatted files is unchanged at 34, none of them touched
by this: the tool reformats a file only if it was already gofmt clean,
so a migration cannot disappear into whitespace.
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
package router
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
jwt "github.com/go-admin-team/go-admin-core/v2/jwtauth"
|
|
"go-admin/app/jobs/apis"
|
|
models2 "go-admin/app/jobs/models"
|
|
dto2 "go-admin/app/jobs/service/dto"
|
|
"go-admin/common/actions"
|
|
"go-admin/common/middleware"
|
|
)
|
|
|
|
func init() {
|
|
routerCheckRole = append(routerCheckRole, registerSysJobRouter)
|
|
}
|
|
|
|
// 需认证的路由代码
|
|
func registerSysJobRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
|
|
|
r := v1.Group("/sysjob").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
|
{
|
|
sysJob := &models2.SysJob{}
|
|
r.GET("", actions.PermissionAction(), actions.IndexAction(sysJob, new(dto2.SysJobSearch), func() interface{} {
|
|
list := make([]models2.SysJob, 0)
|
|
return &list
|
|
}))
|
|
r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto2.SysJobById), func() interface{} {
|
|
return &dto2.SysJobItem{}
|
|
}))
|
|
r.POST("", actions.CreateAction(new(dto2.SysJobControl)))
|
|
r.PUT("", actions.PermissionAction(), actions.UpdateAction(new(dto2.SysJobControl)))
|
|
r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto2.SysJobById)))
|
|
}
|
|
sysJob := apis.SysJob{}
|
|
|
|
v1.GET("/job/remove/:id", sysJob.RemoveJobForService)
|
|
v1.GET("/job/start/:id", sysJob.StartJobForService)
|
|
}
|