Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Main = gcmd.Command{ Name: "Kysion Gf Admin Community", Usage: "Kysion Gf Admin Community", Brief: "Start http server", Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { var ( s = g.Server() oai = s.GetOpenApi() ) { oai.Info.Title = `API Reference` oai.Config.CommonResponse = api_v1.JsonRes{} oai.Config.CommonResponseDataField = `Data` } { uploadPath := g.Cfg().MustGet(ctx, "upload.path").String() if uploadPath == "" { g.Log().Fatal(ctx, "文件上传配置路径不能为空!") } if !gfile.Exists(uploadPath) { _ = gfile.Mkdir(uploadPath) } s.AddStaticPath("/upload", uploadPath) } { if gmode.IsDevelop() { s.BindHookHandler("/*", ghttp.HookBeforeServe, func(r *ghttp.Request) { r.Response.Header().Set("Cache-Control", "no-store") }) } } { sys_service.Casbin().Enforcer() sys_service.SysPermission().ImportPermissionTree(ctx, sys_consts.Global.PermissionTree, nil) } { apiPrefix := g.Cfg().MustGet(ctx, "service.apiPrefix").String() s.Group(apiPrefix, func(group *ghttp.RouterGroup) { group.Middleware( sys_service.Middleware().CTX, sys_service.Middleware().ResponseHandler, ) group.Group("/", func(group *ghttp.RouterGroup) { group.Group("/auth", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.Auth) }) group.Group("/common", func(group *ghttp.RouterGroup) { group.Bind( sys_controller.Captcha, sys_controller.SysSms, sys_controller.SysArea, sys_controller.Common, ) }) }) group.Group("/", func(group *ghttp.RouterGroup) { group.Middleware( sys_service.Middleware().Auth, ) group.Group("/common/file", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysFile) }) group.Group("/system/config", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysConfig) }) group.Group("/system/settings", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysSettings) }) group.Group("/user", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysUser) }) group.Group("/role", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysRole) }) group.Group("/permission", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysPermission) }) group.Group("/organization", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysOrganization) }) group.Group("/my", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysMy) }) group.Group("/license", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysLicense) }) group.Group("/audit", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysAudit) }) group.Group("/menu", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysMenu) }) }) }) } s.Run() return nil }, } )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.