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) _ = sys_service.SysPermission().ImportPermissionTree(ctx, oss_consts.PermissionTree, nil) _ = sys_service.SysPermission().ImportPermissionTree(ctx, sms_consts.PermissionTree, nil) } { sys_consts.Global.CryptoPasswordFunc = func(ctx context.Context, passwordStr string, user ...sys_entity.SysUser) (pwdEncode string) { slat := "kysion.com" if len(user) > 0 { slat = gconv.String(user[0].Id) } pwdHash, _ := en_crypto.PwdHash(passwordStr, slat) return pwdHash } } { apiPrefix := g.Cfg().MustGet(ctx, "service.apiPrefix").String() s.Group(apiPrefix, func(group *ghttp.RouterGroup) { group.Middleware( sys_service.Middleware().CTX, sys_service.Middleware().CORS, 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.SysArea, sys_controller.Common, ) }) }) group.Group("/", func(group *ghttp.RouterGroup) { group.Middleware( sys_service.Middleware().Auth, ) group.Group("/auth", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.UserAuth) }) 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("/utils", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysUtil) }) 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("/person_license", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysLicense) }) group.Group("/person_audit", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysAudit) }) group.Group("/menu", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysMenu) }) group.Group("/invite", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysInvite) }) group.Group("/industry", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysIndustry) }) group.Group("/message", func(group *ghttp.RouterGroup) { group.Bind(sys_controller.SysMessage) }) }) }) } s.Run() return nil }, } )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.