user_router.go
787 字节
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() {
ns := web.NewNamespace("/v1/users",
web.NSBefore(filters.AllowCors(), middlewares.CheckAdminToken()),
web.NSRouter("/search", &controllers.UserController{}, "Post:ListUsers"),
web.NSRouter("/list-dep", &controllers.UserController{}, "Post:ListByDepartment"),
web.NSRouter("/edit-parent", &controllers.UserController{}, "Put:EditParentUser"),
web.NSRouter("/import-parent", &controllers.UserController{}, "Post:ImportParentUser"), // 直接上级导入
)
web.AddNamespace(ns)
}