log
liuxiaolong
2019-08-06 b5df418bd3a9a332caa1559e96136c149b6f0e44
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]