| | |
| | | |
| | | type downOrUpResp struct { |
| | | Url string `json:"url"` |
| | | md5 string `json:"md5"` |
| | | Md5 string `json:"md5"` |
| | | } |
| | | |
| | | //下载或者升级算法 |
| | |
| | | return false, err |
| | | } |
| | | logger.Debug("res.Data:", res.Data, "resp:", resp) |
| | | if resp.Url == "" || resp.md5 == "" { |
| | | if resp.Url == "" || resp.Md5 == "" { |
| | | return false, errors.New("获取下载安装包失败") |
| | | } |
| | | |
| | |
| | | ext := path.Ext(filenameWithSuffix) |
| | | downUrl := "http://"+config.ShopConf.Url+"/files/"+resp.Url |
| | | |
| | | gzFilePath := configPatchPath + "/" + resp.md5+ext |
| | | gzFilePath := configPatchPath + "/" + resp.Md5+ext |
| | | err = reqUtil.DownloadFile(gzFilePath, downUrl) |
| | | if err != nil { |
| | | logger.Debug("DownloadFile err:", err) |
| | | return false, err |
| | | } |
| | | b, err := installSdk(resp.md5, ext) |
| | | b, err := installSdk(resp.Md5, ext) |
| | | if b { |
| | | return true, nil |
| | | } |