2023-07-14 10:16:58 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2023-08-01 14:47:04 +08:00
|
|
|
"joylink.club/bj-rtsts-server/dynamics"
|
2023-07-14 10:16:58 +08:00
|
|
|
|
2023-07-14 16:28:47 +08:00
|
|
|
swaggerFiles "github.com/swaggo/files" // swagger embed files
|
|
|
|
ginSwagger "github.com/swaggo/gin-swagger" // gin-swagger middleware
|
2023-07-14 10:16:58 +08:00
|
|
|
"joylink.club/bj-rtsts-server/api"
|
|
|
|
"joylink.club/bj-rtsts-server/config"
|
2023-07-14 16:28:47 +08:00
|
|
|
"joylink.club/bj-rtsts-server/docs"
|
2023-07-14 10:16:58 +08:00
|
|
|
"joylink.club/bj-rtsts-server/middleware"
|
|
|
|
)
|
|
|
|
|
2023-07-14 16:28:47 +08:00
|
|
|
// @title CBTC测试系统API
|
2023-07-14 10:16:58 +08:00
|
|
|
// @version 1.0
|
2023-07-14 16:28:47 +08:00
|
|
|
// @description CBTC测试服务.
|
2023-07-14 10:16:58 +08:00
|
|
|
|
2023-08-01 14:47:04 +08:00
|
|
|
// @host localhost:9091
|
2023-07-14 16:28:47 +08:00
|
|
|
// @BasePath /
|
2023-07-14 10:16:58 +08:00
|
|
|
|
2023-07-14 16:28:47 +08:00
|
|
|
// @securityDefinitions.apikey JwtAuth
|
2023-07-14 10:16:58 +08:00
|
|
|
// @in header
|
|
|
|
// @name Authorization
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
engine := InitServer()
|
|
|
|
authMiddleware := middleware.InitGinJwtMiddleware()
|
|
|
|
|
|
|
|
router := engine.Group("/api")
|
|
|
|
api.InitUserRouter(router, authMiddleware)
|
2023-07-14 16:47:59 +08:00
|
|
|
api.InitDraftingRouter(router, authMiddleware)
|
2023-07-18 17:19:03 +08:00
|
|
|
api.InitPublishedGiRouter(router, authMiddleware)
|
2023-07-28 14:36:16 +08:00
|
|
|
api.InitSimulationRouter(router, authMiddleware)
|
2023-07-14 10:16:58 +08:00
|
|
|
|
2023-07-14 16:28:47 +08:00
|
|
|
docs.SwaggerInfo.Title = "CBTC测试系统API"
|
|
|
|
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
|
|
|
|
2023-08-01 14:47:04 +08:00
|
|
|
dynamics.RunSendTurnoutInfoTask()
|
|
|
|
|
2023-07-14 10:16:58 +08:00
|
|
|
serverConfig := config.Config.Server
|
|
|
|
if serverConfig.Port == 0 {
|
|
|
|
serverConfig.Port = 8080
|
|
|
|
}
|
|
|
|
|
|
|
|
engine.Run(fmt.Sprintf(":%d", config.Config.Server.Port))
|
|
|
|
}
|