liuxiaolong
2019-08-03 d1c5d57184839d7707557f8468516089b9b54d8e
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 {