Просмотр исходного кода

其他:gin 端口使用bus.DtuServer.Port + 1

zhangjie 2 лет назад
Родитель
Сommit
1e0e45d981
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      api/ginmain.go

+ 6 - 1
api/ginmain.go

@@ -1,6 +1,8 @@
 package api
 
 import (
+	"fmt"
+	bus "github.com/ammeter/Bus"
 	"net/http"
 
 	"github.com/ammeter/util"
@@ -28,8 +30,11 @@ func RestServerStart() {
 	router.GET("/Gateway4G/UpdateDevcie", UpdateDevcie) // hello函数处理"/hello"请求
 	router.GET("/Gateway4G/ListDevices", ListDevices)
 	// 指定地址和端口号
-	go router.Run(":10001")
+	Port := bus.GetFtpServerConfig(nil)
+	log.Infof("gin start. port:%d", Port+1)
+	go router.Run(fmt.Sprintf(":%d", Port+1))
 }
+
 func UpdateDevcie(c *gin.Context) {
 	AppID := c.Query("AppID")
 	AppSecret := c.Query("AppSecret")