This commit is contained in:
2025-09-30 17:44:18 +08:00
parent 898339fd5d
commit f4b7e6e2df
393 changed files with 4530 additions and 2061 deletions

View File

@@ -5,11 +5,12 @@ import (
"flag"
"fmt"
"os"
"hm-server/app/main/api/internal/config"
"hm-server/app/main/api/internal/handler"
"hm-server/app/main/api/internal/middleware"
"hm-server/app/main/api/internal/queue"
"hm-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/config"
"tydata-server/app/main/api/internal/handler"
"tydata-server/app/main/api/internal/middleware"
"tydata-server/app/main/api/internal/queue"
"tydata-server/app/main/api/internal/service"
"tydata-server/app/main/api/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
@@ -60,7 +61,16 @@ func main() {
defer server.Stop()
handler.RegisterHandlers(server, svcContext)
// 自动注册API到数据库
apiRegistry := service.NewApiRegistryService(svcContext.AdminApiModel)
routes := server.Routes()
if err := apiRegistry.RegisterAllApis(context.Background(), routes); err != nil {
logx.Errorf("API注册失败: %v", err)
} else {
logx.Infof("API注册成功共注册 %d 个路由", len(routes))
}
fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
server.Start()
}