From ca43705c99aff58b2745d610b7121c3e81f19851 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期五, 03 七月 2020 10:40:55 +0800 Subject: [PATCH] add sdk install event,after upload done --- controllers/sdk.go | 48 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 36 insertions(+), 12 deletions(-) diff --git a/controllers/sdk.go b/controllers/sdk.go index 479c16c..04737f7 100644 --- a/controllers/sdk.go +++ b/controllers/sdk.go @@ -257,24 +257,48 @@ 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 -- Gitblit v1.8.0