From cb2f80a627413d6dda5b9071a2711cb03964ed15 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 25 九月 2023 10:06:55 +0800
Subject: [PATCH] 任务接口返回通道数量
---
model/response/common.go | 9 +-
docs/swagger.yaml | 30 +++++++++
docs/docs.go | 45 ++++++++++++++
api/v1/task.go | 5 +
docs/swagger.json | 45 ++++++++++++++
5 files changed, 125 insertions(+), 9 deletions(-)
diff --git a/api/v1/task.go b/api/v1/task.go
index 81547c1..a34fdc7 100644
--- a/api/v1/task.go
+++ b/api/v1/task.go
@@ -51,7 +51,7 @@
// @Summary 鑾峰彇浠诲姟
// @Produce application/json
// @Param object query request.TaskList true "鏌ヨ鍙傛暟"
-// @Success 200 {object} contextx.Response{data=response.TaskData} "鎴愬姛"
+// @Success 200 {object} contextx.Response{data=response.TaskResponse} "鎴愬姛"
// @Router /v1/task/get [get]
func (slf *TaskApi) TaskGet(c *gin.Context) {
var params request.TaskList
@@ -71,7 +71,7 @@
}
params.PageSize = channelAmount
-
+
taskResponse, code := service.NewTaskService().GetTask(params.Page, params.PageSize, service.TaskModeCurrent) //鍙栬繘琛屼腑鐨勬垨鏈紑濮嬬殑
if code != ecode.OK {
ctx.Fail(code)
@@ -92,6 +92,7 @@
}
taskResponse.Prompt = conf.Conf.Prompt
+ taskResponse.ChannelAmount = channelAmount
ctx.OkWithDetailed(taskResponse)
}
diff --git a/docs/docs.go b/docs/docs.go
index b41553d..1ce5044 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -460,7 +460,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/response.TaskData"
+ "$ref": "#/definitions/response.TaskResponse"
}
}
}
@@ -685,6 +685,14 @@
"items": {
"$ref": "#/definitions/common.ProcedureWorker"
}
+ }
+ }
+ },
+ "conf.Prompt": {
+ "type": "object",
+ "properties": {
+ "safeProduce": {
+ "type": "string"
}
}
},
@@ -1154,6 +1162,41 @@
"$ref": "#/definitions/model.Procedures"
}
}
+ },
+ "response.TaskResponse": {
+ "type": "object",
+ "properties": {
+ "channelAmount": {
+ "description": "閫氶亾鏁伴噺",
+ "type": "integer"
+ },
+ "prompt": {
+ "description": "鎻愮ず璇�",
+ "allOf": [
+ {
+ "$ref": "#/definitions/conf.Prompt"
+ }
+ ]
+ },
+ "taskCount": {
+ "description": "浠诲姟鏁伴噺",
+ "type": "integer"
+ },
+ "tasks": {
+ "description": "浠诲姟鍒楄〃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.TaskData"
+ }
+ },
+ "workers": {
+ "description": "浜哄憳鍒楄〃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/common.ProcedureWorker"
+ }
+ }
+ }
}
}
}`
diff --git a/docs/swagger.json b/docs/swagger.json
index b8b0852..beeb1a1 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -448,7 +448,7 @@
"type": "object",
"properties": {
"data": {
- "$ref": "#/definitions/response.TaskData"
+ "$ref": "#/definitions/response.TaskResponse"
}
}
}
@@ -673,6 +673,14 @@
"items": {
"$ref": "#/definitions/common.ProcedureWorker"
}
+ }
+ }
+ },
+ "conf.Prompt": {
+ "type": "object",
+ "properties": {
+ "safeProduce": {
+ "type": "string"
}
}
},
@@ -1142,6 +1150,41 @@
"$ref": "#/definitions/model.Procedures"
}
}
+ },
+ "response.TaskResponse": {
+ "type": "object",
+ "properties": {
+ "channelAmount": {
+ "description": "閫氶亾鏁伴噺",
+ "type": "integer"
+ },
+ "prompt": {
+ "description": "鎻愮ず璇�",
+ "allOf": [
+ {
+ "$ref": "#/definitions/conf.Prompt"
+ }
+ ]
+ },
+ "taskCount": {
+ "description": "浠诲姟鏁伴噺",
+ "type": "integer"
+ },
+ "tasks": {
+ "description": "浠诲姟鍒楄〃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/response.TaskData"
+ }
+ },
+ "workers": {
+ "description": "浜哄憳鍒楄〃",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/common.ProcedureWorker"
+ }
+ }
+ }
}
}
}
\ No newline at end of file
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 3ad2a98..87a2541 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -67,6 +67,11 @@
$ref: '#/definitions/common.ProcedureWorker'
type: array
type: object
+ conf.Prompt:
+ properties:
+ safeProduce:
+ type: string
+ type: object
constvar.PlcMethod:
enum:
- modbusTCP
@@ -388,6 +393,29 @@
procedure:
$ref: '#/definitions/model.Procedures'
type: object
+ response.TaskResponse:
+ properties:
+ channelAmount:
+ description: 閫氶亾鏁伴噺
+ type: integer
+ prompt:
+ allOf:
+ - $ref: '#/definitions/conf.Prompt'
+ description: 鎻愮ず璇�
+ taskCount:
+ description: 浠诲姟鏁伴噺
+ type: integer
+ tasks:
+ description: 浠诲姟鍒楄〃
+ items:
+ $ref: '#/definitions/response.TaskData'
+ type: array
+ workers:
+ description: 浜哄憳鍒楄〃
+ items:
+ $ref: '#/definitions/common.ProcedureWorker'
+ type: array
+ type: object
info:
contact: {}
paths:
@@ -654,7 +682,7 @@
- $ref: '#/definitions/contextx.Response'
- properties:
data:
- $ref: '#/definitions/response.TaskData'
+ $ref: '#/definitions/response.TaskResponse'
type: object
summary: 鑾峰彇浠诲姟
tags:
diff --git a/model/response/common.go b/model/response/common.go
index ee3ff27..6bd6284 100644
--- a/model/response/common.go
+++ b/model/response/common.go
@@ -31,10 +31,11 @@
}
type TaskResponse struct {
- Tasks []*TaskData
- TaskCount int64
- Workers []*common.ProcedureWorker `json:"workers"` // 浜哄憳鍒楄〃
- Prompt conf.Prompt
+ Tasks []*TaskData //浠诲姟鍒楄〃
+ TaskCount int64 //浠诲姟鏁伴噺
+ Workers []*common.ProcedureWorker `json:"workers"` // 浜哄憳鍒楄〃
+ Prompt conf.Prompt //鎻愮ず璇�
+ ChannelAmount int //閫氶亾鏁伴噺
}
type Config struct {
--
Gitblit v1.8.0