liuxiaolong
2020-07-02 1b4337e04bc35c8b6f4931a5896f04884fef69c6
controllers/sdk.go
@@ -47,7 +47,7 @@
// @Description 算法保存
// @Accept json
// @Produce json
// @Tags sdk
// @Tags 算法
// @Param reqMap body controllers.SdkVo true "人脸检测"
// @Success 200 {string} json "{"code":200, msg:"请求处理成功",data:"",success:true}"
// @Failure 500 {string} json "{"code":500, msg:"请求失败",data:"",success:false}"
@@ -73,7 +73,7 @@
// @Summary 查找所有算法
// @Description 查找所有算法
// @Produce json
// @Tags sdk
// @Tags 算法
// @Param sdkName query string false "可选参数"
// @Success 200 {string} json "{"code":200, msg:"请求处理成功",data:"算法列表",success:true}"
// @Failure 500 {string} json "{"code":500, msg:"请求失败",data:"[]",success:false}"
@@ -91,7 +91,7 @@
// @Summary 根据id获取算法信息
// @Description 根据id获取算法信息
// @Produce json
// @Tags sdk
// @Tags 算法
// @Param id query string true "算法id,必填"
// @Success 200 {string} json "{"code":200, msg:"请求处理成功",data:"算法信息",success:true}"
// @Failure 500 {string} json "{"code":500, msg:"请求失败",data:"",success:false}"
@@ -134,7 +134,7 @@
// @Summary 根据taskId获取算法信息
// @Description 根据taskId获取算法信息
// @Produce json
// @Tags sdk
// @Tags 算法
// @Param taskId query string true "taskId,必填"
// @Success 200 {string} json "{"code":200, msg:"请求处理成功",data:"算法信息",success:true}"
// @Failure 500 {string} json "{"code":500, msg:"请求失败",data:"",success:false}"
@@ -158,7 +158,7 @@
// @Description 算法安装包上传(分块检查)
// @Accept multipart/form-data
// @Produce json
// @Tags sdk
// @Tags 算法
// @Param chunkNumber formData int true "当前是第几个分块"
// @Param chunkSize formData int true "每一块的大小"
// @Param currentChunkSize formData int true "当前块的大小"
@@ -210,7 +210,7 @@
// @Description 算法安装包上传
// @Accept multipart/form-data
// @Produce json
// @Tags sysset
// @Tags 算法
// @Param chunkNumber formData int true "当前是第几个分块"
// @Param chunkSize formData int true "每一块的大小"
// @Param currentChunkSize formData int true "当前块的大小"
@@ -278,7 +278,7 @@
// @Summary 从商城下载或升级算法
// @Description 从商城下载或升级算法
// @Produce json
// @Tags sysset
// @Tags 算法
// @Param path query string true "算法id"
// @Success 200 {string} json "{"code":200, msg:"", success:true}"
// @Failure 500 {string} json "{"code":500, msg:"", success:false}"
@@ -296,3 +296,27 @@
      util.ResponseFormat(c, &code.Code{http.StatusBadRequest, false, err.Error()}, err.Error())
   }
}
// @Security ApiKeyAuth
// @Summary 使用激活码激活安装算法
// @Description 使用激活码激活安装算法
// @Produce json
// @Tags 算法
// @Param code query string true "激活码"
// @Success 200 {string} json "{"code":200, msg:"", success:true}"
// @Failure 500 {string} json "{"code":500, msg:"", success:false}"
// @Router /data/api-v/sdk/active [get]
func (sc SdkController) Active(c *gin.Context) {
   cod := c.GetString("code")
   if cod == "" {
      util.ResponseFormat(c, code.RequestParamError, "激活码不能为空")
      return
   }
   var sv service.SdkInstallService
   err := sv.Active(cod)
   if err == nil {
      util.ResponseFormat(c,code.Success,  "激活成功")
   } else {
      util.ResponseFormat(c,code.ComError, err.Error())
   }
}