fix
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user