Commit 17b7e888 authored by szh's avatar szh

版本更新

parent d4ed146c
......@@ -68,6 +68,7 @@ func UpdatePai(c *gin.Context) {
app.DPercent.Flag = false
return
}
//对比版本号
version := util.VersionCompare(app.GetVersion())
updateversion := util.VersionCompare(req.Version)
if updateversion <= version {
......@@ -75,6 +76,21 @@ func UpdatePai(c *gin.Context) {
app.DPercent.Flag = false
return
}
//检查版本号是否存在于online数据库
var pai pai_service.Pai
latest,err := pai.GetPaiLatestVersion(int32(2))
if err != nil {
appG.Response(http.StatusOK, e.DOWNLOAD_ERROR, err)
app.DPercent.Flag = false
return
}
latestversion := util.VersionCompare(latest)
if updateversion > latestversion {
appG.Response(http.StatusOK, e.VERSION_UPDATE_ERROR, nil)
app.DPercent.Flag = false
return
}
name := setting.Chain33Pai.Name+"_"+req.Version+".tar.gz"
url := setting.Chain33Pai.DownloadUrl+ name
//oss下载更新包
......
......@@ -159,4 +159,4 @@ func (p *Pai) GetPaiLatestVersion(t int32) (string,error) {
return "",err
}
return r.Data,nil
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment