From d1c5d57184839d7707557f8468516089b9b54d8e Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期六, 03 八月 2019 16:24:53 +0800 Subject: [PATCH] fix taskSdkAdd --- controllers/task.go | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/controllers/task.go b/controllers/task.go index 0acdb4f..91892d0 100644 --- a/controllers/task.go +++ b/controllers/task.go @@ -94,6 +94,9 @@ type TaskSdkAdd struct { TaskId string `json:"taskId"` + Sdks []SdkSort `json:"sdks"` +} +type SdkSort struct { SdkId string `json:"sdkId"` Sort int `json:"sort"` } @@ -102,20 +105,20 @@ // @Description 浠诲姟娣诲姞绠楁硶 // @Produce json // @Tags task -// @Param taskId query string true "浠诲姟id" -// @Param sdkId query string true "绠楁硶id" +// @Param taskSdkAdd body controllers.TaskSdkAdd true "浠诲姟id" // @Success 200 {string} json "{"code":200, msg:"璇锋眰澶勭悊鎴愬姛",data:"",success:true}" // @Failure 500 {string} json "{"code":500, msg:"璇锋眰澶辫触",data:"",success:false}" // @Router /data/api-v/task/addTaskSdk [post] func (tc TaskController) AddTaskSdk(c *gin.Context) { var addVo TaskSdkAdd err := c.BindJSON(&addVo) - if err !=nil || addVo.TaskId == "" || addVo.SdkId == "" { + if err !=nil || addVo.TaskId == "" || len(addVo.Sdks)==0 { util.ResponseFormat(c,code.RequestParamError,"鍙傛暟鏈夎") return } + paramBody := util.Struct2Map(addVo) var taskApi dbapi.TaskApi - flag,data := taskApi.AddTaskSdk(addVo.TaskId, addVo.SdkId, addVo.Sort) + flag,data := taskApi.AddTaskSdk(paramBody) if flag { util.ResponseFormat(c, code.ComError, data) } else { -- Gitblit v1.8.0