From aaa7697d6ec77e03d96ce36ca66abcbbcf2bb7a3 Mon Sep 17 00:00:00 2001
From: liuxiaolong <liuxiaolong@aiotlink.com>
Date: 星期二, 14 七月 2020 12:03:33 +0800
Subject: [PATCH] add ruleSo

---
 controllers/sdk.go |   93 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 75 insertions(+), 18 deletions(-)

diff --git a/controllers/sdk.go b/controllers/sdk.go
index 238e47a..04737f7 100644
--- a/controllers/sdk.go
+++ b/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 "褰撳墠鍧楃殑澶у皬"
@@ -257,23 +257,56 @@
 		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
+// @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}"
+// @Router /data/api-v/sdk/sdkDownload [get]
 func (sc SdkController) SdkDownLoad(c *gin.Context) {
 	sdkId, exist := c.GetQuery("path")
 	if !exist {
@@ -287,3 +320,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())
+	}
+}
\ No newline at end of file

--
Gitblit v1.8.0