仿真基本接口及模拟返回的数据

This commit is contained in:
tiger_zhou 2023-07-28 15:49:44 +08:00
parent 5a0246a928
commit 76bf8570c8
7 changed files with 1491 additions and 14 deletions

View File

@ -13,7 +13,12 @@ import (
func InitSimulationRouter(api *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
authed := api.Group("/v1/simulation").Use(authMiddleware.MiddlewareFunc())
authed.POST("/create", create)
authed.POST("/destroy", destroy)
authed.GET("/list", findAllSimulations)
authed.POST("/train/add", addTrain)
authed.POST("/check/data", checkSimMapData)
authed.POST("/train/remove", removeTrain)
authed.POST("/switch/operation", switchOperation)
}
// 创建ATS测试仿真
@ -71,3 +76,130 @@ func addTrain(c *gin.Context) {
rsp.TrainId = "666"
c.JSON(http.StatusOK, &rsp)
}
// ATS仿真销毁
//
// @Summary ATS仿真销毁
//
// @Security JwtAuth
//
// @Description ATS测试仿真-添加列车
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
// @Param id path int true "仿真id"
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/train/destroy/{id} [get]
func destroy(c *gin.Context) {
simId := c.Param("id")
zap.S().Debug("ATS测试仿真-ATS仿真销毁 请求:", simId)
c.JSON(http.StatusOK, "ok")
}
// 获取ATS测试系统所有仿真实例的基本信息
//
// @Summary 获取ATS测试系统所有仿真实例的基本信息
//
// @Security JwtAuth
//
// @Description ATS测试仿真-添加列车
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
//
// @Success 200 {object} dto.SimulationInfoRepDtoArr
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/list [get]
func findAllSimulations(c *gin.Context) {
zap.S().Debug("ATS测试仿真-获取ATS测试系统所有仿真实例的基本信息,请求")
//TODO 后续调用
c.JSON(http.StatusOK, dto.SimulationInfoRepDtoArr{dto.SimulationInfoRepDto{"1", "123"}, dto.SimulationInfoRepDto{"2", "333"}})
}
// ATS测试仿真地图数据校验
//
// @Summary ATS测试仿真地图数据校验
//
// @Security JwtAuth
//
// @Description ATS测试仿真-添加列车
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
// @Param RemoveTrainDto body dto.CheckMapDataReqDto true "ATS测试仿真-地图数据"
//
// @Success 200 {object} dto.CheckMapDataRspDto
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/check/data [post]
func checkSimMapData(c *gin.Context) {
rt := &dto.CheckMapDataRspDto{}
err := c.Bind(rt)
if err != nil {
c.JSON(http.StatusInternalServerError, "参数错误")
} else {
//TODO 后续调用
c.JSON(http.StatusOK, dto.CheckMapDataRspDto{true, []string{"error"}})
}
}
// 获取ATS测试系统所有仿真实例的基本信息
//
// @Summary 获取ATS测试系统所有仿真实例的基本信息
//
// @Security JwtAuth
//
// @Description ATS测试仿真-添加列车
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
// @Param RemoveTrainDto body dto.RemoveTrainDto true "ATS测试仿真-移除列车"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/train/remove [post]
func removeTrain(c *gin.Context) {
rt := &dto.RemoveTrainDto{}
err := c.Bind(rt)
if err != nil {
c.JSON(http.StatusInternalServerError, "参数错误")
} else {
//TODO 后续调用列车删除操作
c.JSON(http.StatusOK, "ok")
}
}
// 获取ATS测试-操作道岔
//
// @Summary 获取ATS测试-操作道岔
//
// @Security JwtAuth
//
// @Description ATS测试仿真-添加列车
// @Tags ATS测试仿真Api
// @Accept json
// @Produce json
// @Param Authorization header string true "JWT Token"
// @Param RemoveTrainDto body dto.SwitchOperationReqDto true "ATS测试仿真-操作道岔"
//
// @Success 200 {object} string
// @Failure 500 {object} dto.ErrorDto
// @Router /api/v1/simulation/switch/operation [post]
func switchOperation(c *gin.Context) {
switchOper := &dto.SwitchOperationReqDto{}
err := c.Bind(switchOper)
if err != nil {
c.JSON(http.StatusInternalServerError, "参数错误")
} else {
//TODO 后续调用道岔操作
c.JSON(http.StatusOK, "ok")
}
}

@ -1 +1 @@
Subproject commit 19233a128e14357f084d0794e9040ad1dcda1e16
Subproject commit c09c46511d43178e55491efeab848445ea35ddbf

View File

@ -140,7 +140,7 @@ const docTemplate = `{
"JwtAuth": []
}
],
"description": "草稿另存为",
"description": "修改草稿信息",
"consumes": [
"application/json"
],
@ -150,7 +150,7 @@ const docTemplate = `{
"tags": [
"草稿Api"
],
"summary": "草稿另存为",
"summary": "修改草稿信息",
"parameters": [
{
"type": "integer",
@ -737,6 +737,362 @@ const docTemplate = `{
}
}
},
"/api/v1/simulation/check/data": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "ATS测试仿真地图数据校验",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "ATS测试仿真-地图数据",
"name": "RemoveTrainDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CheckMapDataReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.CheckMapDataRspDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/create": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "创建ATS测试仿真",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "创建ATS测试仿真",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "创建仿真请求",
"name": "SimulationCreateReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.SimulationCreateReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.SimulationCreateRspDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/list": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试系统所有仿真实例的基本信息",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SimulationInfoRepDto"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/switch/operation": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试-操作道岔",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "ATS测试仿真-操作道岔",
"name": "RemoveTrainDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.SwitchOperationReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/train/add": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "ATS测试仿真-添加列车",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "ATS测试仿真-添加列车",
"name": "AddTrainReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.AddTrainReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AddTrainRspDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/train/destroy/{id}": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "ATS仿真销毁",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "仿真id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/train/remove": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试系统所有仿真实例的基本信息",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "ATS测试仿真-移除列车",
"name": "RemoveTrainDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.RemoveTrainDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/user/current": {
"get": {
"description": "获取当前登录用户信息",
@ -933,6 +1289,68 @@ const docTemplate = `{
}
},
"definitions": {
"dto.AddTrainReqDto": {
"type": "object",
"properties": {
"headLinkId": {
"description": "车头所在link的索引",
"type": "string"
},
"headLinkOffset": {
"description": "车头所在link内的偏移量单位为mm",
"type": "integer"
},
"simulationId": {
"description": "仿真id",
"type": "string"
},
"up": {
"description": "列车方向,true-上行false-下行",
"type": "boolean"
}
}
},
"dto.AddTrainRspDto": {
"type": "object",
"properties": {
"simulationId": {
"description": "仿真id",
"type": "string"
},
"trainId": {
"description": "新添加的列车的索引",
"type": "string"
}
}
},
"dto.CheckMapDataReqDto": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"dto.CheckMapDataRspDto": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"type": "string"
}
},
"success": {
"type": "boolean"
}
}
},
"dto.ErrorDto": {
"type": "object",
"properties": {
@ -1028,6 +1446,83 @@ const docTemplate = `{
}
}
},
"dto.RemoveTrainDto": {
"type": "object",
"properties": {
"headLinkId": {
"description": "车头所在link的索引",
"type": "string"
},
"headLinkOffset": {
"description": "车头所在link内的偏移量单位为mm",
"type": "integer"
},
"simulationId": {
"description": "仿真id",
"type": "string"
},
"up": {
"description": "列车方向,true-上行false-下行",
"type": "boolean"
}
}
},
"dto.SimulationCreateReqDto": {
"type": "object",
"properties": {
"mapId": {
"description": "地图id",
"type": "integer"
}
}
},
"dto.SimulationCreateRspDto": {
"type": "object",
"properties": {
"mapId": {
"description": "地图id",
"type": "integer"
},
"simulationId": {
"description": "仿真id",
"type": "string"
}
}
},
"dto.SimulationInfoRepDto": {
"type": "object",
"properties": {
"mapId": {
"type": "string"
},
"simulationId": {
"type": "string"
}
}
},
"dto.SwitchOperationReqDto": {
"type": "object",
"required": [
"simulationId",
"switchIndex",
"turnNormal",
"turnReverse"
],
"properties": {
"simulationId": {
"type": "string"
},
"switchIndex": {
"type": "string"
},
"turnNormal": {
"type": "boolean"
},
"turnReverse": {
"type": "boolean"
}
}
},
"dto.TokenRespDto": {
"type": "object",
"properties": {

View File

@ -133,7 +133,7 @@
"JwtAuth": []
}
],
"description": "草稿另存为",
"description": "修改草稿信息",
"consumes": [
"application/json"
],
@ -143,7 +143,7 @@
"tags": [
"草稿Api"
],
"summary": "草稿另存为",
"summary": "修改草稿信息",
"parameters": [
{
"type": "integer",
@ -730,6 +730,362 @@
}
}
},
"/api/v1/simulation/check/data": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "ATS测试仿真地图数据校验",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "ATS测试仿真-地图数据",
"name": "RemoveTrainDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CheckMapDataReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.CheckMapDataRspDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/create": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "创建ATS测试仿真",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "创建ATS测试仿真",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "创建仿真请求",
"name": "SimulationCreateReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.SimulationCreateReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.SimulationCreateRspDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/list": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试系统所有仿真实例的基本信息",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SimulationInfoRepDto"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/switch/operation": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试-操作道岔",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "ATS测试仿真-操作道岔",
"name": "RemoveTrainDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.SwitchOperationReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/train/add": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "ATS测试仿真-添加列车",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "ATS测试仿真-添加列车",
"name": "AddTrainReqDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.AddTrainReqDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.AddTrainRspDto"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/train/destroy/{id}": {
"get": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "ATS仿真销毁",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "仿真id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/simulation/train/remove": {
"post": {
"security": [
{
"JwtAuth": []
}
],
"description": "ATS测试仿真-添加列车",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ATS测试仿真Api"
],
"summary": "获取ATS测试系统所有仿真实例的基本信息",
"parameters": [
{
"type": "string",
"description": "JWT Token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "ATS测试仿真-移除列车",
"name": "RemoveTrainDto",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.RemoveTrainDto"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/dto.ErrorDto"
}
}
}
}
},
"/api/v1/user/current": {
"get": {
"description": "获取当前登录用户信息",
@ -926,6 +1282,68 @@
}
},
"definitions": {
"dto.AddTrainReqDto": {
"type": "object",
"properties": {
"headLinkId": {
"description": "车头所在link的索引",
"type": "string"
},
"headLinkOffset": {
"description": "车头所在link内的偏移量单位为mm",
"type": "integer"
},
"simulationId": {
"description": "仿真id",
"type": "string"
},
"up": {
"description": "列车方向,true-上行false-下行",
"type": "boolean"
}
}
},
"dto.AddTrainRspDto": {
"type": "object",
"properties": {
"simulationId": {
"description": "仿真id",
"type": "string"
},
"trainId": {
"description": "新添加的列车的索引",
"type": "string"
}
}
},
"dto.CheckMapDataReqDto": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"dto.CheckMapDataRspDto": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"type": "string"
}
},
"success": {
"type": "boolean"
}
}
},
"dto.ErrorDto": {
"type": "object",
"properties": {
@ -1021,6 +1439,83 @@
}
}
},
"dto.RemoveTrainDto": {
"type": "object",
"properties": {
"headLinkId": {
"description": "车头所在link的索引",
"type": "string"
},
"headLinkOffset": {
"description": "车头所在link内的偏移量单位为mm",
"type": "integer"
},
"simulationId": {
"description": "仿真id",
"type": "string"
},
"up": {
"description": "列车方向,true-上行false-下行",
"type": "boolean"
}
}
},
"dto.SimulationCreateReqDto": {
"type": "object",
"properties": {
"mapId": {
"description": "地图id",
"type": "integer"
}
}
},
"dto.SimulationCreateRspDto": {
"type": "object",
"properties": {
"mapId": {
"description": "地图id",
"type": "integer"
},
"simulationId": {
"description": "仿真id",
"type": "string"
}
}
},
"dto.SimulationInfoRepDto": {
"type": "object",
"properties": {
"mapId": {
"type": "string"
},
"simulationId": {
"type": "string"
}
}
},
"dto.SwitchOperationReqDto": {
"type": "object",
"required": [
"simulationId",
"switchIndex",
"turnNormal",
"turnReverse"
],
"properties": {
"simulationId": {
"type": "string"
},
"switchIndex": {
"type": "string"
},
"turnNormal": {
"type": "boolean"
},
"turnReverse": {
"type": "boolean"
}
}
},
"dto.TokenRespDto": {
"type": "object",
"properties": {

View File

@ -1,5 +1,47 @@
basePath: /
definitions:
dto.AddTrainReqDto:
properties:
headLinkId:
description: 车头所在link的索引
type: string
headLinkOffset:
description: 车头所在link内的偏移量单位为mm
type: integer
simulationId:
description: 仿真id
type: string
up:
description: 列车方向,true-上行false-下行
type: boolean
type: object
dto.AddTrainRspDto:
properties:
simulationId:
description: 仿真id
type: string
trainId:
description: 新添加的列车的索引
type: string
type: object
dto.CheckMapDataReqDto:
properties:
data:
items:
type: integer
type: array
required:
- data
type: object
dto.CheckMapDataRspDto:
properties:
errors:
items:
type: string
type: array
success:
type: boolean
type: object
dto.ErrorDto:
properties:
code:
@ -67,6 +109,59 @@ definitions:
description: 注册时间
type: string
type: object
dto.RemoveTrainDto:
properties:
headLinkId:
description: 车头所在link的索引
type: string
headLinkOffset:
description: 车头所在link内的偏移量单位为mm
type: integer
simulationId:
description: 仿真id
type: string
up:
description: 列车方向,true-上行false-下行
type: boolean
type: object
dto.SimulationCreateReqDto:
properties:
mapId:
description: 地图id
type: integer
type: object
dto.SimulationCreateRspDto:
properties:
mapId:
description: 地图id
type: integer
simulationId:
description: 仿真id
type: string
type: object
dto.SimulationInfoRepDto:
properties:
mapId:
type: string
simulationId:
type: string
type: object
dto.SwitchOperationReqDto:
properties:
simulationId:
type: string
switchIndex:
type: string
turnNormal:
type: boolean
turnReverse:
type: boolean
required:
- simulationId
- switchIndex
- turnNormal
- turnReverse
type: object
dto.TokenRespDto:
properties:
code:
@ -236,7 +331,7 @@ paths:
put:
consumes:
- application/json
description: 草稿另存为
description: 修改草稿信息
parameters:
- description: 草稿ID
in: path
@ -274,7 +369,7 @@ paths:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 草稿另存为
summary: 修改草稿信息
tags:
- 草稿Api
/api/v1/drafting/:id/saveAs:
@ -590,6 +685,232 @@ paths:
summary: 从草稿发布数据
tags:
- 发布的图形数据Api
/api/v1/simulation/check/data:
post:
consumes:
- application/json
description: ATS测试仿真-添加列车
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: ATS测试仿真-地图数据
in: body
name: RemoveTrainDto
required: true
schema:
$ref: '#/definitions/dto.CheckMapDataReqDto'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.CheckMapDataRspDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: ATS测试仿真地图数据校验
tags:
- ATS测试仿真Api
/api/v1/simulation/create:
post:
consumes:
- application/json
description: 创建ATS测试仿真
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 创建仿真请求
in: body
name: SimulationCreateReqDto
required: true
schema:
$ref: '#/definitions/dto.SimulationCreateReqDto'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.SimulationCreateRspDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 创建ATS测试仿真
tags:
- ATS测试仿真Api
/api/v1/simulation/list:
get:
consumes:
- application/json
description: ATS测试仿真-添加列车
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/dto.SimulationInfoRepDto'
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 获取ATS测试系统所有仿真实例的基本信息
tags:
- ATS测试仿真Api
/api/v1/simulation/switch/operation:
post:
consumes:
- application/json
description: ATS测试仿真-添加列车
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: ATS测试仿真-操作道岔
in: body
name: RemoveTrainDto
required: true
schema:
$ref: '#/definitions/dto.SwitchOperationReqDto'
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 获取ATS测试-操作道岔
tags:
- ATS测试仿真Api
/api/v1/simulation/train/add:
post:
consumes:
- application/json
description: ATS测试仿真-添加列车
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: ATS测试仿真-添加列车
in: body
name: AddTrainReqDto
required: true
schema:
$ref: '#/definitions/dto.AddTrainReqDto'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.AddTrainRspDto'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: ATS测试仿真-添加列车
tags:
- ATS测试仿真Api
/api/v1/simulation/train/destroy/{id}:
get:
consumes:
- application/json
description: ATS测试仿真-添加列车
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: 仿真id
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: ATS仿真销毁
tags:
- ATS测试仿真Api
/api/v1/simulation/train/remove:
post:
consumes:
- application/json
description: ATS测试仿真-添加列车
parameters:
- description: JWT Token
in: header
name: Authorization
required: true
type: string
- description: ATS测试仿真-移除列车
in: body
name: RemoveTrainDto
required: true
schema:
$ref: '#/definitions/dto.RemoveTrainDto'
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/dto.ErrorDto'
security:
- JwtAuth: []
summary: 获取ATS测试系统所有仿真实例的基本信息
tags:
- ATS测试仿真Api
/api/v1/user/current:
get:
consumes:

View File

@ -37,3 +37,35 @@ type AddTrainRspDto struct {
}
/////////////////////////////////////////////////////////////////////////////////
// 仿真移除列车请求
type RemoveTrainDto AddTrainReqDto
/////////////////////////////////////////////////////////////////////////////////
type SwitchOperationReqDto struct {
SimulationId string `form:"simulationId" json:"simulationId" binding:"required"`
SwitchIndex string `form:"switchIndex" json:"switchIndex" binding:"required"`
TurnNormal bool `form:"turnNormal" json:"turnNormal" binding:"required"`
TurnReverse bool `form:"turnReverse" json:"turnReverse" binding:"required"`
}
/////////////////////////////////////////////////////////////////////////////////
// 地铁数据检测请求
type CheckMapDataReqDto struct {
Data []byte `form:"data" json:"data" binding:"required"`
}
// 地图检验数据响应
type CheckMapDataRspDto struct {
Success bool `form:"success" json:"success"`
Errors []string `form:"errors" json:"errors"`
}
// 仿真实例的基本信息响应
type SimulationInfoRepDto struct {
SimulationId string `form:"simulationId" json:"simulationId"`
MapId string `form:"mapId" json:"mapId"`
}
type SimulationInfoRepDtoArr []SimulationInfoRepDto

View File

@ -25,7 +25,7 @@ func PagingQueryUser(query *dto.PageUserReqDto) (*dto.PageDto, error) {
return &dto.PageDto{Total: int(total), PageQueryDto: query.PageQueryDto, Records: records}, err
}
func Register(user *dto.RegisterUser) error {
func Register(user *dto.RegisterUser) {
defer func() {
err := recover()
if err != nil {
@ -33,16 +33,18 @@ func Register(user *dto.RegisterUser) error {
panic(err)
}
}()
/* if user.Mobile == "" || len([]rune(user.Mobile)) != 13 {
panic("asdfasdf")
}*/
u := dbquery.User
uq := u.Where()
uq = uq.Where(u.Mobile.Eq(user.Mobile))
findUsers, err := uq.Find()
if len(findUsers) > 0 {
findCounter, _ := uq.Count()
if findCounter > 0 {
panic("重复的手机号")
}
user.RegisterTime = time.Now()
u.Save(user)
return err
}
func FindUserInfo(userId int32) *dto.RegisterUser {