From a6da86f91d9e6c63489b5c8c5d8dde99fc68725d Mon Sep 17 00:00:00 2001 From: weizhihong Date: Sat, 7 Oct 2023 17:51:00 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E7=BB=A7=E7=94=B5?= =?UTF-8?q?=E5=99=A8=E5=B1=9E=E6=80=A7=E5=AD=97=E6=AE=B5=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/simulation.go | 2 +- docs/docs.go | 145 +++++++++++++++++++++++++--------------------- docs/swagger.json | 145 +++++++++++++++++++++++++--------------------- docs/swagger.yaml | 103 +++++++++++++++++--------------- 4 files changed, 214 insertions(+), 181 deletions(-) diff --git a/api/simulation.go b/api/simulation.go index f2d74c9..49ff375 100644 --- a/api/simulation.go +++ b/api/simulation.go @@ -289,7 +289,7 @@ func relayOperation(c *gin.Context) { } simulation := checkDeviceDataAndReturn(req.SimulationId) zap.S().Info("传入状态参数", req) - memory.ChangeRelayState(simulation, req.MapId, req.Id, req.td) + memory.ChangeRelayState(simulation, req.MapId, req.Id, req.Td) c.JSON(http.StatusOK, "ok") } diff --git a/docs/docs.go b/docs/docs.go index 2cf3529..0953445 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2664,58 +2664,6 @@ const docTemplate = `{ } } }, - "/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/createByProject": { "post": { "security": [ @@ -2907,14 +2855,14 @@ const docTemplate = `{ } } }, - "/api/v1/simulation/state/:id": { - "get": { + "/api/v1/simulation/relay/operation": { + "post": { "security": [ { "JwtAuth": [] } ], - "description": "创建并进入仿真后获取仿真的设备信息", + "description": "ATS测试-操作继电器", "consumes": [ "application/json" ], @@ -2924,7 +2872,7 @@ const docTemplate = `{ "tags": [ "ATS测试仿真Api" ], - "summary": "创建并进入仿真后获取仿真的设备信息", + "summary": "获取ATS测试-操作继电器", "parameters": [ { "type": "string", @@ -2934,18 +2882,20 @@ const docTemplate = `{ "required": true }, { - "type": "integer", - "description": "仿真id", - "name": "id", - "in": "path", - "required": true + "description": "ATS测试仿真-操作继电器", + "name": "RelayOperationReqDto", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RelayOperationReqDto" + } } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/dto.SimulationCreateRspDto" + "type": "string" } }, "500": { @@ -4438,6 +4388,10 @@ const docTemplate = `{ "description": "物理区段、道岔ID", "type": "string" }, + "mapId": { + "description": "场景ID", + "type": "integer" + }, "simulationId": { "description": "仿真id", "type": "string" @@ -4455,6 +4409,10 @@ const docTemplate = `{ "dto.AddTrainRspDto": { "type": "object", "properties": { + "mapId": { + "description": "场景ID", + "type": "integer" + }, "simulationId": { "description": "仿真id", "type": "string" @@ -4527,7 +4485,10 @@ const docTemplate = `{ "code": { "type": "integer" }, - "message": { + "detail": { + "type": "string" + }, + "title": { "type": "string" } } @@ -4629,6 +4590,9 @@ const docTemplate = `{ }, "name": { "type": "string" + }, + "type": { + "type": "integer" } } }, @@ -4656,9 +4620,35 @@ const docTemplate = `{ } } }, + "dto.RelayOperationReqDto": { + "type": "object", + "required": [ + "id", + "mapId", + "simulationId" + ], + "properties": { + "id": { + "type": "string" + }, + "mapId": { + "type": "integer" + }, + "simulationId": { + "type": "string" + }, + "td": { + "type": "boolean" + } + } + }, "dto.RemoveTrainDto": { "type": "object", "properties": { + "mapId": { + "description": "场景ID", + "type": "integer" + }, "simulationId": { "description": "仿真id", "type": "string" @@ -4689,6 +4679,13 @@ const docTemplate = `{ "description": "地图id", "type": "integer" }, + "mapIds": { + "description": "地图列表", + "type": "array", + "items": { + "type": "integer" + } + }, "projectId": { "description": "项目ID", "type": "integer" @@ -4705,6 +4702,12 @@ const docTemplate = `{ "mapId": { "type": "integer" }, + "mapIds": { + "type": "array", + "items": { + "type": "integer" + } + }, "projectId": { "type": "integer" }, @@ -4716,14 +4719,18 @@ const docTemplate = `{ "dto.SwitchOperationReqDto": { "type": "object", "required": [ - "simulationId", - "switchIndex" + "id", + "mapId", + "simulationId" ], "properties": { - "simulationId": { + "id": { "type": "string" }, - "switchIndex": { + "mapId": { + "type": "integer" + }, + "simulationId": { "type": "string" }, "turnNormal": { @@ -4964,6 +4971,10 @@ const docTemplate = `{ "description": "显示状态", "type": "integer" }, + "type": { + "description": "数据类型", + "type": "integer" + }, "user_id": { "description": "发布用户id", "type": "integer" diff --git a/docs/swagger.json b/docs/swagger.json index 10462e2..1515196 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2657,58 +2657,6 @@ } } }, - "/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/createByProject": { "post": { "security": [ @@ -2900,14 +2848,14 @@ } } }, - "/api/v1/simulation/state/:id": { - "get": { + "/api/v1/simulation/relay/operation": { + "post": { "security": [ { "JwtAuth": [] } ], - "description": "创建并进入仿真后获取仿真的设备信息", + "description": "ATS测试-操作继电器", "consumes": [ "application/json" ], @@ -2917,7 +2865,7 @@ "tags": [ "ATS测试仿真Api" ], - "summary": "创建并进入仿真后获取仿真的设备信息", + "summary": "获取ATS测试-操作继电器", "parameters": [ { "type": "string", @@ -2927,18 +2875,20 @@ "required": true }, { - "type": "integer", - "description": "仿真id", - "name": "id", - "in": "path", - "required": true + "description": "ATS测试仿真-操作继电器", + "name": "RelayOperationReqDto", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.RelayOperationReqDto" + } } ], "responses": { "200": { "description": "OK", "schema": { - "$ref": "#/definitions/dto.SimulationCreateRspDto" + "type": "string" } }, "500": { @@ -4431,6 +4381,10 @@ "description": "物理区段、道岔ID", "type": "string" }, + "mapId": { + "description": "场景ID", + "type": "integer" + }, "simulationId": { "description": "仿真id", "type": "string" @@ -4448,6 +4402,10 @@ "dto.AddTrainRspDto": { "type": "object", "properties": { + "mapId": { + "description": "场景ID", + "type": "integer" + }, "simulationId": { "description": "仿真id", "type": "string" @@ -4520,7 +4478,10 @@ "code": { "type": "integer" }, - "message": { + "detail": { + "type": "string" + }, + "title": { "type": "string" } } @@ -4622,6 +4583,9 @@ }, "name": { "type": "string" + }, + "type": { + "type": "integer" } } }, @@ -4649,9 +4613,35 @@ } } }, + "dto.RelayOperationReqDto": { + "type": "object", + "required": [ + "id", + "mapId", + "simulationId" + ], + "properties": { + "id": { + "type": "string" + }, + "mapId": { + "type": "integer" + }, + "simulationId": { + "type": "string" + }, + "td": { + "type": "boolean" + } + } + }, "dto.RemoveTrainDto": { "type": "object", "properties": { + "mapId": { + "description": "场景ID", + "type": "integer" + }, "simulationId": { "description": "仿真id", "type": "string" @@ -4682,6 +4672,13 @@ "description": "地图id", "type": "integer" }, + "mapIds": { + "description": "地图列表", + "type": "array", + "items": { + "type": "integer" + } + }, "projectId": { "description": "项目ID", "type": "integer" @@ -4698,6 +4695,12 @@ "mapId": { "type": "integer" }, + "mapIds": { + "type": "array", + "items": { + "type": "integer" + } + }, "projectId": { "type": "integer" }, @@ -4709,14 +4712,18 @@ "dto.SwitchOperationReqDto": { "type": "object", "required": [ - "simulationId", - "switchIndex" + "id", + "mapId", + "simulationId" ], "properties": { - "simulationId": { + "id": { "type": "string" }, - "switchIndex": { + "mapId": { + "type": "integer" + }, + "simulationId": { "type": "string" }, "turnNormal": { @@ -4957,6 +4964,10 @@ "description": "显示状态", "type": "integer" }, + "type": { + "description": "数据类型", + "type": "integer" + }, "user_id": { "description": "发布用户id", "type": "integer" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index e5d8d91..5d62b66 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -17,6 +17,9 @@ definitions: id: description: 物理区段、道岔ID type: string + mapId: + description: 场景ID + type: integer simulationId: description: 仿真id type: string @@ -29,6 +32,9 @@ definitions: type: object dto.AddTrainRspDto: properties: + mapId: + description: 场景ID + type: integer simulationId: description: 仿真id type: string @@ -76,7 +82,9 @@ definitions: properties: code: type: integer - message: + detail: + type: string + title: type: string type: object dto.LoginDto: @@ -147,6 +155,8 @@ definitions: type: integer name: type: string + type: + type: integer type: object dto.RegisterUser: properties: @@ -165,8 +175,26 @@ definitions: description: 注册时间 type: string type: object + dto.RelayOperationReqDto: + properties: + id: + type: string + mapId: + type: integer + simulationId: + type: string + td: + type: boolean + required: + - id + - mapId + - simulationId + type: object dto.RemoveTrainDto: properties: + mapId: + description: 场景ID + type: integer simulationId: description: 仿真id type: string @@ -188,6 +216,11 @@ definitions: mapId: description: 地图id type: integer + mapIds: + description: 地图列表 + items: + type: integer + type: array projectId: description: 项目ID type: integer @@ -199,6 +232,10 @@ definitions: properties: mapId: type: integer + mapIds: + items: + type: integer + type: array projectId: type: integer simulationId: @@ -206,17 +243,20 @@ definitions: type: object dto.SwitchOperationReqDto: properties: - simulationId: + id: type: string - switchIndex: + mapId: + type: integer + simulationId: type: string turnNormal: type: boolean turnReverse: type: boolean required: + - id + - mapId - simulationId - - switchIndex type: object dto.TokenRespDto: properties: @@ -382,6 +422,9 @@ definitions: status: description: 显示状态 type: integer + type: + description: 数据类型 + type: integer user_id: description: 发布用户id type: integer @@ -2133,39 +2176,6 @@ paths: 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/createByProject: post: consumes: @@ -2287,36 +2297,37 @@ paths: summary: 获取ATS测试系统所有仿真实例的基本信息 tags: - ATS测试仿真Api - /api/v1/simulation/state/:id: - get: + /api/v1/simulation/relay/operation: + post: consumes: - application/json - description: 创建并进入仿真后获取仿真的设备信息 + description: ATS测试-操作继电器 parameters: - description: JWT Token in: header name: Authorization required: true type: string - - description: 仿真id - in: path - name: id + - description: ATS测试仿真-操作继电器 + in: body + name: RelayOperationReqDto required: true - type: integer + schema: + $ref: '#/definitions/dto.RelayOperationReqDto' produces: - application/json responses: "200": description: OK schema: - $ref: '#/definitions/dto.SimulationCreateRspDto' + type: string "500": description: Internal Server Error schema: $ref: '#/definitions/dto.ErrorDto' security: - JwtAuth: [] - summary: 创建并进入仿真后获取仿真的设备信息 + summary: 获取ATS测试-操作继电器 tags: - ATS测试仿真Api /api/v1/simulation/switch/operation: