diff --git a/api/simulation.go b/api/simulation.go index 43ead75..326ea63 100644 --- a/api/simulation.go +++ b/api/simulation.go @@ -267,7 +267,7 @@ func addTrain(c *gin.Context) { TrainEndsB: memory.DtoTrainEndsToStateProto(req.ConfigTrain.TrainEndsB), },*/ } - memory.AddTrainStateNew(simulation, rsp, req.ConfigTrain, req.MapId) + memory.AddTrainStateNew(simulation, rsp, req.ConfigTrain, req.TrainEndsA, req.TrainEndsB, req.MapId) c.JSON(http.StatusOK, &rsp) } diff --git a/docs/docs.go b/docs/docs.go index 10d0644..af5dc2e 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -5014,6 +5014,22 @@ const docTemplate = `{ } ] }, + "TrainEndsA": { + "description": "车辆A端", + "allOf": [ + { + "$ref": "#/definitions/dto.ConfigTrainEnds" + } + ] + }, + "TrainEndsB": { + "description": "车辆B端", + "allOf": [ + { + "$ref": "#/definitions/dto.ConfigTrainEnds" + } + ] + }, "devicePort": { "description": "道岔端口", "type": "string" @@ -5222,22 +5238,6 @@ const docTemplate = `{ "dto.ConfigTrainData": { "type": "object", "properties": { - "TrainEndsA": { - "description": "车辆A端", - "allOf": [ - { - "$ref": "#/definitions/dto.ConfigTrainEnds" - } - ] - }, - "TrainEndsB": { - "description": "车辆B端", - "allOf": [ - { - "$ref": "#/definitions/dto.ConfigTrainEnds" - } - ] - }, "baseResistanceParamA": { "description": "Mass int32 ` + "`" + `json:\"mass\" form:\"mass\"` + "`" + ` // 列车的质量(100=1ton)", "type": "number" @@ -5316,6 +5316,22 @@ const docTemplate = `{ "dto.ConfigTrainReqDto": { "type": "object", "properties": { + "TrainEndsA": { + "description": "车辆A端", + "allOf": [ + { + "$ref": "#/definitions/dto.ConfigTrainEnds" + } + ] + }, + "TrainEndsB": { + "description": "车辆B端", + "allOf": [ + { + "$ref": "#/definitions/dto.ConfigTrainEnds" + } + ] + }, "TrainId": { "description": "列车Id", "type": "integer" @@ -5818,6 +5834,9 @@ const docTemplate = `{ "dto.TrainInfoDto": { "type": "object", "properties": { + "TrainConfigData": { + "$ref": "#/definitions/dto.ConfigTrainData" + }, "carriage_length": { "type": "integer" }, diff --git a/docs/swagger.json b/docs/swagger.json index ac0a61b..4985acc 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -5008,6 +5008,22 @@ } ] }, + "TrainEndsA": { + "description": "车辆A端", + "allOf": [ + { + "$ref": "#/definitions/dto.ConfigTrainEnds" + } + ] + }, + "TrainEndsB": { + "description": "车辆B端", + "allOf": [ + { + "$ref": "#/definitions/dto.ConfigTrainEnds" + } + ] + }, "devicePort": { "description": "道岔端口", "type": "string" @@ -5216,22 +5232,6 @@ "dto.ConfigTrainData": { "type": "object", "properties": { - "TrainEndsA": { - "description": "车辆A端", - "allOf": [ - { - "$ref": "#/definitions/dto.ConfigTrainEnds" - } - ] - }, - "TrainEndsB": { - "description": "车辆B端", - "allOf": [ - { - "$ref": "#/definitions/dto.ConfigTrainEnds" - } - ] - }, "baseResistanceParamA": { "description": "Mass int32 `json:\"mass\" form:\"mass\"` // 列车的质量(100=1ton)", "type": "number" @@ -5310,6 +5310,22 @@ "dto.ConfigTrainReqDto": { "type": "object", "properties": { + "TrainEndsA": { + "description": "车辆A端", + "allOf": [ + { + "$ref": "#/definitions/dto.ConfigTrainEnds" + } + ] + }, + "TrainEndsB": { + "description": "车辆B端", + "allOf": [ + { + "$ref": "#/definitions/dto.ConfigTrainEnds" + } + ] + }, "TrainId": { "description": "列车Id", "type": "integer" @@ -5812,6 +5828,9 @@ "dto.TrainInfoDto": { "type": "object", "properties": { + "TrainConfigData": { + "$ref": "#/definitions/dto.ConfigTrainData" + }, "carriage_length": { "type": "integer" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index b1ed642..48860fc 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -41,6 +41,14 @@ definitions: allOf: - $ref: '#/definitions/dto.ConfigTrainData' description: 列车数据配置 + TrainEndsA: + allOf: + - $ref: '#/definitions/dto.ConfigTrainEnds' + description: 车辆A端 + TrainEndsB: + allOf: + - $ref: '#/definitions/dto.ConfigTrainEnds' + description: 车辆B端 devicePort: description: 道岔端口 type: string @@ -183,14 +191,6 @@ definitions: type: object dto.ConfigTrainData: properties: - TrainEndsA: - allOf: - - $ref: '#/definitions/dto.ConfigTrainEnds' - description: 车辆A端 - TrainEndsB: - allOf: - - $ref: '#/definitions/dto.ConfigTrainEnds' - description: 车辆B端 baseResistanceParamA: description: Mass int32 `json:"mass" form:"mass"` // 列车的质量(100=1ton) @@ -249,6 +249,14 @@ definitions: type: object dto.ConfigTrainReqDto: properties: + TrainEndsA: + allOf: + - $ref: '#/definitions/dto.ConfigTrainEnds' + description: 车辆A端 + TrainEndsB: + allOf: + - $ref: '#/definitions/dto.ConfigTrainEnds' + description: 车辆B端 TrainId: description: 列车Id type: integer @@ -589,6 +597,8 @@ definitions: type: object dto.TrainInfoDto: properties: + TrainConfigData: + $ref: '#/definitions/dto.ConfigTrainData' carriage_length: type: integer description: