From 1b4337e04bc35c8b6f4931a5896f04884fef69c6 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期四, 02 七月 2020 15:18:43 +0800 Subject: [PATCH] fix AggregateTaskList --- service/SdkInstall.go | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/service/SdkInstall.go b/service/SdkInstall.go index 2f6c74a..62e7af2 100644 --- a/service/SdkInstall.go +++ b/service/SdkInstall.go @@ -2,6 +2,7 @@ import ( "basic.com/dbapi.git" + "basic.com/valib/licence.git" "basic.com/valib/logger.git" "encoding/json" "errors" @@ -13,12 +14,46 @@ "strings" "webserver/extend/config" "webserver/extend/util" + reqUtil "webserver/extend/util" ) type SdkInstallService struct { } +func (sv SdkInstallService) Active(cod string) error { + //浣跨敤婵�娲荤爜婵�娲荤畻娉� + url := "http://"+config.ShopConf.Url+"/data/api-s/sdk/activeByAINode" + machineCode := licence.GetMachineCode() + if machineCode == "" { + logger.Debug("鑾峰彇鏈哄櫒鐮佸け璐�") + return errors.New("鑾峰彇鏈哄櫒鐮佸け璐�") + } + paramBody := map[string]interface{}{ + "code": cod, + "machineCode": machineCode, + } + header := map[string]string { + "Authorization": token, + } + respBody, err := reqUtil.DoPostRequest(url, reqUtil.CONTENT_TYPE_JSON, paramBody, nil, header) + if err != nil { + logger.Debug("DoPostRequest err:", err) + return err + } + var res dbapi.Result + if err = json.Unmarshal(respBody, &res); err != nil { + logger.Debug("unmarshal err:", err) + return err + } + if !res.Success { + logger.Debug("res.Data:", res.Data) + return errors.New("璇锋眰鍟嗗煄澶辫触") + } + + return nil +} + //绠楁硶瀹夎鍖呭畨瑁� func (sv SdkInstallService) SdkInstall(identifier string,filename string) (bool,error) { configPatchPath := "" -- Gitblit v1.8.0