| | |
| | | Header: header, |
| | | } |
| | | var sv service.SysService |
| | | if b,isComplete := sv.PatchUpload(&arg); b { |
| | | if isComplete { //上传完毕需要自动触发安装 |
| | | var sv service.SdkInstallService |
| | | if b,err := sv.SdkInstall(identifier, filename);b { |
| | | util.ResponseFormat(c,&code.Code{http.StatusOK, true, "算法安装成功"},"算法安装成功") |
| | | return |
| | | } else { |
| | | util.ResponseFormat(c,&code.Code{http.StatusBadRequest, false, "算法安装失败"},err.Error()) |
| | | return |
| | | } |
| | | } |
| | | util.ResponseFormat(c, code.Success, "") |
| | | if b,_ := sv.PatchUpload(&arg); b { |
| | | //if isComplete { //上传完毕需要自动触发安装 |
| | | // var sv service.SdkInstallService |
| | | // if b,err := sv.SdkInstall(identifier, filename);b { |
| | | // util.ResponseFormat(c,&code.Code{http.StatusOK, true, "算法安装成功"},"算法安装成功") |
| | | // return |
| | | // } else { |
| | | // util.ResponseFormat(c,&code.Code{http.StatusBadRequest, false, "算法安装失败"},err.Error()) |
| | | // return |
| | | // } |
| | | //} |
| | | util.ResponseFormat(c, code.Success, "上传完成") |
| | | } else { |
| | | util.ResponseFormat(c, code.ComError, "") |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 上传完成开始安装 |
| | | // @Description 上传完成开始安装 |
| | | // @Produce json |
| | | // @Tags 算法 |
| | | // @Param identifier formData string true "整个文件的唯一标识,目前是md5" |
| | | // @Param filename formData 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/install [post] |
| | | func (sc SdkController) Install(c *gin.Context) { |
| | | identifier := c.Request.FormValue("identifier") |
| | | filename := c.Request.FormValue("filename") |
| | | |
| | | var sv service.SdkInstallService |
| | | if b,err := sv.SdkInstall(identifier, filename);b { |
| | | util.ResponseFormat(c,&code.Code{http.StatusOK, true, "算法安装成功"},"算法安装成功") |
| | | return |
| | | } else { |
| | | util.ResponseFormat(c,&code.Code{http.StatusBadRequest, false, "算法安装失败"},err.Error()) |
| | | return |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 从商城下载或升级算法 |
| | | // @Description 从商城下载或升级算法 |
| | | // @Produce json |