From 1e24626fa58f488f7744ce94e88a650f05c7a749 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 08 八月 2019 18:53:38 +0800
Subject: [PATCH] add log

---
 controllers/task.go |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/controllers/task.go b/controllers/task.go
index 2a2f10a..8366edc 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,24 +105,24 @@
 // @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)
+		util.ResponseFormat(c, code.Success, data)
 	} else {
-		util.ResponseFormat(c,code.Success,data)
+		util.ResponseFormat(c,code.ComError,data)
 	}
 }
 
@@ -142,9 +145,9 @@
 	}
 	flag,data := taskApi.DeleteTaskSdk(taskId,sdkId)
 	if flag {
-		util.ResponseFormat(c, code.ComError, data)
+		util.ResponseFormat(c, code.Success, data)
 	} else {
-		util.ResponseFormat(c,code.Success,data)
+		util.ResponseFormat(c,code.ComError, data)
 	}
 }
 
@@ -152,8 +155,8 @@
 // @Description 鏇存柊浠诲姟鍚嶇О
 // @Produce json
 // @Tags task
-// @Param taskId body string true "taskId"
-// @Param taskName body string true "taskName"
+// @Param taskId query string true "taskId"
+// @Param taskName query string true "taskName"
 // @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/updateTaskName [POST]
@@ -231,7 +234,7 @@
 type TaskSdkRules struct {
 	TaskId string `json:"taskId"`
 	SdkId string  `json:"sdkId"`
-	rules []TaskSdkRuleVo `json:"rules"`
+	Rules []TaskSdkRuleVo `json:"rules"`
 }
 
 type TaskSdkRuleVo struct {
@@ -271,7 +274,7 @@
 // @Description 鍒犻櫎绠楁硶瑙勫垯
 // @Produce json
 // @Tags 绠楁硶瑙勫垯
-// @Param id body string true "id"
+// @Param id query string true "id"
 // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}"
 // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}"
 // @Router /data/api-v/task/deleteTaskSdkRuleById [post]

--
Gitblit v1.8.0