package routers import ( "eta/eta_mini_crm/controllers" beego "github.com/beego/beego/v2/server/web" "github.com/beego/beego/v2/server/web/filter/cors" ) func init() { beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{ AllowAllOrigins: true, AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, AllowHeaders: []string{"Origin", "Authorization", "Uuid", "Accesstoken", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"}, ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"}, AllowCredentials: true, })) ns := beego.NewNamespace("/adminapi", beego.NSNamespace("/sys_user", beego.NSInclude( &controllers.UserLoginController{}, &controllers.SysUserController{}, ), ), beego.NSNamespace("/department", beego.NSInclude( &controllers.SysDepartmentController{}, ), ), beego.NSNamespace("/role", beego.NSInclude( &controllers.SysRoleController{}, ), ), beego.NSNamespace("/chart_permission", beego.NSInclude( &controllers.ChartPermissionController{}, ), ), beego.NSNamespace("/user", beego.NSInclude( &controllers.UserController{}, ), ), beego.NSNamespace("/sys_message", beego.NSInclude( &controllers.SysMessageReportController{}, ), ), beego.NSNamespace("/seller", beego.NSInclude( &controllers.SellerController{}, ), ), beego.NSNamespace("/classify", beego.NSInclude( &controllers.ClassifyController{}, ), ), beego.NSNamespace("/read", beego.NSInclude( &controllers.UserReadRecordController{}, ), ), beego.NSNamespace("/report_pdf", beego.NSInclude( &controllers.ReportPdfController{}, ), ), beego.NSNamespace("/report_push", beego.NSInclude( &controllers.ReportPushStatusController{}, ), ), ) beego.AddNamespace(ns) }