优化结构

This commit is contained in:
Yvan
2026-08-25 00:20:29 +08:00
parent 969afee284
commit ee179d6b34
49 changed files with 289 additions and 591 deletions
-27
View File
@@ -1,27 +0,0 @@
package router
import "kra/internal/server/handler"
type Set = handler.Set
type Announcement = handler.Announcement
type API = handler.API
type APIToken = handler.APIToken
type Audit = handler.Audit
type Authority = handler.Authority
type Dictionary = handler.Dictionary
type Email = handler.Email
type Export = handler.Export
type Media = handler.Media
type Menu = handler.Menu
type Navigation = handler.Navigation
type Organization = handler.Organization
type Parameter = handler.Parameter
type Payment = handler.Payment
type Permission = handler.Permission
type Public = handler.Public
type Session = handler.Session
type SystemConfig = handler.SystemConfig
type Task = handler.Task
type User = handler.User
type Version = handler.Version
type IntegrationConfig = handler.IntegrationConfig
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterAnnouncement(private, public *gin.RouterGroup, h *Announcement) {
func RegisterAnnouncement(private, public *gin.RouterGroup, h *handler.Announcement) {
privateInfo := private.Group("/info")
privateInfo.POST("/createInfo", h.Create)
privateInfo.DELETE("/deleteInfo", h.Delete)
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterAPI(group, public *gin.RouterGroup, engine *gin.Engine, h *API) {
func RegisterAPI(group, public *gin.RouterGroup, engine *gin.Engine, h *handler.API) {
api := group.Group("/api")
api.POST("/getApiList", h.List)
api.POST("/getAllApis", h.All)
+5 -4
View File
@@ -2,11 +2,12 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterAPIToken(group *gin.RouterGroup, handler *APIToken) {
func RegisterAPIToken(group *gin.RouterGroup, h *handler.APIToken) {
router := group.Group("/sysApiToken")
router.POST("/createApiToken", handler.Create)
router.POST("/getApiTokenList", handler.List)
router.POST("/deleteApiToken", handler.Delete)
router.POST("/createApiToken", h.Create)
router.POST("/getApiTokenList", h.List)
router.POST("/deleteApiToken", h.Delete)
}
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterAudit(group, public *gin.RouterGroup, h *Audit) {
func RegisterAudit(group, public *gin.RouterGroup, h *handler.Audit) {
operations := group.Group("/sysOperationRecord")
operations.GET("/getSysOperationRecordList", h.Operations)
operations.GET("/findSysOperationRecord", h.Operation)
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterAuthority(group *gin.RouterGroup, h *Authority) {
func RegisterAuthority(group *gin.RouterGroup, h *handler.Authority) {
router := group.Group("/authority")
router.POST("/getAuthorityList", h.List)
router.POST("/createAuthority", h.Create)
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterDictionary(group *gin.RouterGroup, h *Dictionary) {
func RegisterDictionary(group *gin.RouterGroup, h *handler.Dictionary) {
dictionaries := group.Group("/sysDictionary")
dictionaries.POST("/createSysDictionary", h.Create)
dictionaries.PUT("/updateSysDictionary", h.Update)
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterEmail(group *gin.RouterGroup, h *Email) {
func RegisterEmail(group *gin.RouterGroup, h *handler.Email) {
email := group.Group("/email")
email.POST("/emailTest", h.Test)
email.POST("/sendEmail", h.Send)
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterExport(group, public *gin.RouterGroup, h *Export) {
func RegisterExport(group, public *gin.RouterGroup, h *handler.Export) {
router := group.Group("/sysExportTemplate")
router.POST("/createSysExportTemplate", h.Create)
router.PUT("/updateSysExportTemplate", h.Update)
+11 -7
View File
@@ -1,12 +1,16 @@
package router
import "github.com/gin-gonic/gin"
import (
"kra/internal/server/handler"
func RegisterIntegrationConfig(group *gin.RouterGroup, handler *IntegrationConfig) {
"github.com/gin-gonic/gin"
)
func RegisterIntegrationConfig(group *gin.RouterGroup, h *handler.IntegrationConfig) {
configs := group.Group("/integration/configs")
configs.GET("/:kind", handler.List)
configs.GET("/:kind/:provider", handler.Find)
configs.PUT("/:kind/:provider", handler.Save)
configs.POST("/:kind/:provider/test", handler.Test)
configs.DELETE("/:kind/:provider", handler.Delete)
configs.GET("/:kind", h.List)
configs.GET("/:kind/:provider", h.Find)
configs.PUT("/:kind/:provider", h.Save)
configs.POST("/:kind/:provider/test", h.Test)
configs.DELETE("/:kind/:provider", h.Delete)
}
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterMedia(group *gin.RouterGroup, h *Media) {
func RegisterMedia(group *gin.RouterGroup, h *handler.Media) {
files := group.Group("/fileUploadAndDownload")
files.POST("/upload", h.Upload)
files.POST("/getFileList", h.List)
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterMenu(group *gin.RouterGroup, h *Menu) {
func RegisterMenu(group *gin.RouterGroup, h *handler.Menu) {
router := group.Group("/menu")
router.POST("/getMenuList", h.List)
router.POST("/getBaseMenuTree", h.Tree)
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterOrganization(group *gin.RouterGroup, h *Organization) {
func RegisterOrganization(group *gin.RouterGroup, h *handler.Organization) {
departments := group.Group("/department")
departments.POST("/getDepartmentList", h.ListDepartments)
departments.POST("/createDepartment", h.CreateDepartment)
+9 -8
View File
@@ -2,15 +2,16 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterParameter(group *gin.RouterGroup, handler *Parameter) {
func RegisterParameter(group *gin.RouterGroup, h *handler.Parameter) {
router := group.Group("/sysParams")
router.POST("/createSysParams", handler.Create)
router.PUT("/updateSysParams", handler.Update)
router.DELETE("/deleteSysParams", handler.Delete)
router.DELETE("/deleteSysParamsByIds", handler.DeleteMany)
router.GET("/findSysParams", handler.Find)
router.GET("/getSysParam", handler.Get)
router.GET("/getSysParamsList", handler.List)
router.POST("/createSysParams", h.Create)
router.PUT("/updateSysParams", h.Update)
router.DELETE("/deleteSysParams", h.Delete)
router.DELETE("/deleteSysParamsByIds", h.DeleteMany)
router.GET("/findSysParams", h.Find)
router.GET("/getSysParam", h.Get)
router.GET("/getSysParamsList", h.List)
}
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterPayment(group, public *gin.RouterGroup, h *Payment) {
func RegisterPayment(group, public *gin.RouterGroup, h *handler.Payment) {
payment := group.Group("/payment")
payment.GET("/orders", h.Orders)
payment.POST("/providers/:provider/test", h.TestProvider)
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterPermission(group *gin.RouterGroup, h *Permission) {
func RegisterPermission(group *gin.RouterGroup, h *handler.Permission) {
buttons := group.Group("/authorityBtn")
buttons.POST("/getAuthorityBtn", h.Buttons)
buttons.POST("/setAuthorityBtn", h.SetButtons)
+6 -5
View File
@@ -2,13 +2,14 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterPublic(group *gin.RouterGroup, engine *gin.Engine, handler *Public) {
func RegisterPublic(group *gin.RouterGroup, engine *gin.Engine, h *handler.Public) {
base := group.Group("/base")
base.POST("/captcha", handler.Captcha)
base.POST("/login", handler.Login)
base.POST("/captcha", h.Captcha)
base.POST("/login", h.Login)
init := group.Group("/init")
init.POST("/checkdb", handler.CheckDatabase)
init.POST("/initdb", handler.InitializeDatabase(engine))
init.POST("/checkdb", h.CheckDatabase)
init.POST("/initdb", h.InitializeDatabase(engine))
}
+3 -2
View File
@@ -1,16 +1,17 @@
package router
import (
"kra/internal/server/handler"
platformmodule "kra/pkg/module"
"github.com/gin-gonic/gin"
)
type Routes struct {
handlers *Set
handlers *handler.Set
}
func NewRoutes(handlers *Set) *Routes { return &Routes{handlers: handlers} }
func NewRoutes(handlers *handler.Set) *Routes { return &Routes{handlers: handlers} }
var _ platformmodule.RouteRegistrar = (*Routes)(nil)
+8 -7
View File
@@ -2,16 +2,17 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterSystemConfig(group *gin.RouterGroup, handler *SystemConfig) {
func RegisterSystemConfig(group *gin.RouterGroup, h *handler.SystemConfig) {
security := group.Group("/securityConfig")
security.GET("/getSecurityConfig", handler.GetSecurity)
security.POST("/setSecurityConfig", handler.SetSecurity)
security.GET("/getSecurityConfig", h.GetSecurity)
security.POST("/setSecurityConfig", h.SetSecurity)
system := group.Group("/system")
system.POST("/getSystemConfig", handler.Get)
system.POST("/setSystemConfig", handler.Set)
system.POST("/reloadSystem", handler.Reload)
system.POST("/getServerInfo", handler.ServerInfo)
system.POST("/getSystemConfig", h.Get)
system.POST("/setSystemConfig", h.Set)
system.POST("/reloadSystem", h.Reload)
system.POST("/getServerInfo", h.ServerInfo)
}
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterTask(group *gin.RouterGroup, h *Task) {
func RegisterTask(group *gin.RouterGroup, h *handler.Task) {
router := group.Group("/timedTask")
router.POST("/createTimedTask", h.Create)
router.PUT("/updateTimedTask", h.Update)
+17 -16
View File
@@ -2,27 +2,28 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterUser(group *gin.RouterGroup, handler *User) {
func RegisterUser(group *gin.RouterGroup, h *handler.User) {
user := group.Group("/user")
user.POST("/getUserList", handler.List)
user.POST("/admin_register", handler.Create)
user.PUT("/setUserInfo", handler.Update)
user.PUT("/setSelfInfo", handler.UpdateSelf)
user.DELETE("/deleteUser", handler.Delete)
user.POST("/resetPassword", handler.ResetPassword)
user.POST("/changePassword", handler.ChangePassword)
user.PUT("/setSelfSetting", handler.SetSelfSetting)
user.POST("/setUserAuthorities", handler.SetAuthorities)
user.POST("/setUserAuthority", handler.SwitchAuthority)
user.GET("/getUserInfo", handler.Get)
user.POST("/getUserList", h.List)
user.POST("/admin_register", h.Create)
user.PUT("/setUserInfo", h.Update)
user.PUT("/setSelfInfo", h.UpdateSelf)
user.DELETE("/deleteUser", h.Delete)
user.POST("/resetPassword", h.ResetPassword)
user.POST("/changePassword", h.ChangePassword)
user.PUT("/setSelfSetting", h.SetSelfSetting)
user.POST("/setUserAuthorities", h.SetAuthorities)
user.POST("/setUserAuthority", h.SwitchAuthority)
user.GET("/getUserInfo", h.Get)
}
func RegisterNavigation(group *gin.RouterGroup, handler *Navigation) {
group.Group("/menu").POST("/getMenu", handler.Menu)
func RegisterNavigation(group *gin.RouterGroup, h *handler.Navigation) {
group.Group("/menu").POST("/getMenu", h.Menu)
}
func RegisterSession(group *gin.RouterGroup, handler *Session) {
group.Group("/jwt").POST("/jsonInBlacklist", handler.Logout)
func RegisterSession(group *gin.RouterGroup, h *handler.Session) {
group.Group("/jwt").POST("/jsonInBlacklist", h.Logout)
}
+2 -1
View File
@@ -2,9 +2,10 @@ package router
import (
"github.com/gin-gonic/gin"
"kra/internal/server/handler"
)
func RegisterVersion(group *gin.RouterGroup, h *Version) {
func RegisterVersion(group *gin.RouterGroup, h *handler.Version) {
router := group.Group("/sysVersion")
router.DELETE("/deleteSysVersion", h.Delete)
router.DELETE("/deleteSysVersionByIds", h.DeleteMany)