yjp 1 жил өмнө
parent
commit
52f4699d3e

+ 7 - 0
project/gateway/api/api.go

@@ -26,6 +26,13 @@ func NewGateway() {
 
 	// 创建gateway
 	gatewayInstance = gateway.NewGateway(appInstance.Api())
+
+	// 启动Version
+	appInstance.Api().PrefixRouter().AddRoute(http.MethodGet, "/version", func(c *api.Context) {
+		c.JSON(http.StatusOK, map[string]any{
+			"version": "v1.0.0",
+		})
+	})
 }
 
 func DestroyGateway() {

+ 0 - 1
project/gateway/api/root/example/example.go

@@ -10,7 +10,6 @@ var (
 )
 
 func InitGateway(builder *gateway.Builder) {
-	versionGateway(builder)
 	configurationGateway(builder)
 	sqlExecutorGateway(builder)
 }

+ 0 - 19
project/gateway/api/root/example/version.go

@@ -1,19 +0,0 @@
-package example
-
-import (
-	"git.sxidc.com/go-framework/baize/convenient/gwtools"
-	"git.sxidc.com/go-framework/baize/framework/gateway"
-)
-
-var (
-	versionBaseUrl = serviceVersionedUrl + "/version"
-)
-
-func versionGateway(builder *gateway.Builder) {
-	gwtools.GetPassThrough(builder, &gwtools.SimplePassThroughParams{
-		RelativePath: "/version",
-		Request: &gateway.GetRequest{
-			Url: versionBaseUrl,
-		},
-	})
-}