后端重构

This commit is contained in:
Yvan
2026-01-08 20:16:27 +08:00
parent 9cb6b965e0
commit f5f77b32fe
23 changed files with 1450 additions and 2 deletions
@@ -18,8 +18,13 @@ func (r *FileUploadRouter) InitFileUploadRouter(Router *gin.RouterGroup) {
fileUploadRouter.POST("deleteFile", api.DeleteFile)
fileUploadRouter.POST("editFileName", api.EditFileName)
fileUploadRouter.POST("importURL", api.ImportURL)
// 断点续传
fileUploadRouter.POST("breakpointContinue", api.BreakpointContinue)
fileUploadRouter.POST("breakpointContinueFinish", api.BreakpointContinueFinish)
fileUploadRouter.POST("removeChunk", api.RemoveChunk)
}
{
fileUploadRouterWithoutRecord.POST("getFileList", api.GetFileList)
fileUploadRouterWithoutRecord.GET("findFile", api.FindFile)
}
}
+24 -2
View File
@@ -1,6 +1,7 @@
package system
import (
handler "kra/internal/server/handler/system"
"kra/internal/server/middleware"
"github.com/gin-gonic/gin"
@@ -12,11 +13,32 @@ type AutoCodeRouter struct{}
func (s *AutoCodeRouter) InitAutoCodeRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {
autoCodeRouter := Router.Group("autoCode").Use(middleware.OperationRecordMiddleware())
autoCodeRouterWithoutRecord := Router.Group("autoCode")
publicAutoCodeRouter := PublicRouter.Group("autoCode")
{
autoCodeRouterWithoutRecord.GET("getDB", autoCodeApi.GetDB) // 获取数据库
autoCodeRouterWithoutRecord.GET("getTables", autoCodeApi.GetTables) // 获取对应数据库的表
autoCodeRouterWithoutRecord.GET("getColumn", autoCodeApi.GetColumn) // 获取指定表所有字段信息
}
// 预留其他路由
_ = autoCodeRouter
{
// 代码包管理
autoCodeRouter.POST("getPackage", handler.GetPackages) // 获取所有包
autoCodeRouter.POST("delPackage", handler.DeletePackage) // 删除包
autoCodeRouter.GET("getTemplates", handler.GetTemplates) // 获取所有模版
}
{
// 代码模板
autoCodeRouter.POST("preview", handler.PreviewCode) // 预览代码
autoCodeRouter.POST("createTemp", handler.CreateCode) // 创建代码
autoCodeRouter.POST("addFunc", handler.AddFunc) // 增加方法
}
{
// 插件管理
autoCodeRouter.POST("pubPlug", handler.PackagedPlugin) // 打包插件
autoCodeRouter.POST("installPlugin", handler.InstallPlugin) // 安装插件
}
{
// 公开路由
publicAutoCodeRouter.POST("initMenu", handler.InitPluginMenu) // 初始化插件菜单
publicAutoCodeRouter.POST("initAPI", handler.InitPluginAPI) // 初始化插件API
}
}