From cb2f80a627413d6dda5b9071a2711cb03964ed15 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 25 九月 2023 10:06:55 +0800 Subject: [PATCH] 任务接口返回通道数量 --- api/v1/task.go | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/api/v1/task.go b/api/v1/task.go index 2a15943..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 @@ -59,12 +59,18 @@ if !ok { return } + + channelAmount, err := service.NewDevicePlcService().GetDeviceChannelAmount() + if err != nil { + ctx.FailWithMsg(ecode.NeedConfirmedErr, err.Error()) + return + } + if params.Page <= 0 { params.Page = 1 } - if params.PageSize <= 0 { - params.PageSize = 1 - } + + params.PageSize = channelAmount taskResponse, code := service.NewTaskService().GetTask(params.Page, params.PageSize, service.TaskModeCurrent) //鍙栬繘琛屼腑鐨勬垨鏈紑濮嬬殑 if code != ecode.OK { @@ -86,6 +92,7 @@ } taskResponse.Prompt = conf.Conf.Prompt + taskResponse.ChannelAmount = channelAmount ctx.OkWithDetailed(taskResponse) } -- Gitblit v1.8.0