| | |
| | | return res.Success |
| | | } |
| | | |
| | | func (api AppApi) GetAppInfo(id string) (flag bool, d interface{}) { |
| | | url := DATA_URL_PREFIX + "/app/getAppInfo" |
| | | netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url)) |
| | | client := NewClient(WithNodes(netNode)) |
| | | paramMap := map[string]string { |
| | | "id": id, |
| | | } |
| | | body, err := client.DoGetRequest(url,paramMap,nil) |
| | | if err != nil { |
| | | return false, err.Error() |
| | | } |
| | | |
| | | var res Result |
| | | if err = json.Unmarshal(body, &res); err != nil { |
| | | return false, err.Error() |
| | | } |
| | | return res.Success, res.Data |
| | | } |
| | | |
| | | func (api AppApi) Delete(appId string) (bool,interface{}) { |
| | | url := DATA_URL_PREFIX + "/app/delete" |
| | | netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url)) |
| | | client := NewClient(WithNodes(netNode)) |
| | | paramBody := map[string]interface{} { |
| | | "appId": appId, |
| | | } |
| | | body, err := client.DoPostRequest(url,CONTENT_TYPE_JSON,paramBody,nil,nil) |
| | | if err != nil { |
| | | return false, err.Error() |
| | | } |
| | | |
| | | var res Result |
| | | if err = json.Unmarshal(body, &res); err != nil { |
| | | return false, err.Error() |
| | | } |
| | | return res.Success, res.Data |
| | | } |
| | | |
| | | //获取所有已安装的app列表,以package为key |
| | | func (api AppApi) FindAppMap() map[string]protomsg.App { |
| | | m := make(map[string]protomsg.App) |
| | |
| | | } |
| | | return res.Success |
| | | } |
| | | |
| | | func (api SdkApi) Delete(sdkId string) (bool, interface{}) { |
| | | url := DATA_URL_PREFIX + "/sdk/delete" |
| | | netNode := getNetNode(url2Topic(Topic_AppCenter_Service, url)) |
| | | client := NewClient(WithNodes(netNode)) |
| | | paramBody := map[string]interface{}{ |
| | | "sdkId": sdkId, |
| | | } |
| | | respBody,err := client.DoPostRequest(url, CONTENT_TYPE_JSON, paramBody, nil, nil) |
| | | if err !=nil { |
| | | return false, err.Error() |
| | | } |
| | | var res Result |
| | | if err = json.Unmarshal(respBody, &res);err !=nil { |
| | | return false, err.Error() |
| | | } |
| | | return res.Success, res.Data |
| | | } |