mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
feat(update):优化软件更新逻辑
- 增加对操作系统类型的判断,非 Windows 系统不执行更新 - 优化更新版本信息的传递方式 -重构代码,提高可读性和可维护性
This commit is contained in:
parent
a66f2156f1
commit
2d224ccfc4
10
app.go
10
app.go
@ -135,8 +135,14 @@ func (a *App) CheckUpdate() {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
releaseVersion.Commit = *commit
|
releaseVersion.Commit = *commit
|
||||||
}
|
}
|
||||||
//sha:= commit.Sha
|
|
||||||
resp, err := resty.New().R().Get(fmt.Sprintf("https://github.com/ArvinLovegood/go-stock/releases/download/%s/go-stock-windows-amd64.exe", releaseVersion.TagName))
|
if !IsWindows() {
|
||||||
|
go runtime.EventsEmit(a.ctx, "updateVersion", releaseVersion)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadUrl := fmt.Sprintf("https://github.com/ArvinLovegood/go-stock/releases/download/%s/go-stock-windows-amd64.exe", releaseVersion.TagName)
|
||||||
|
resp, err := resty.New().R().Get(downloadUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
go runtime.EventsEmit(a.ctx, "newsPush", map[string]any{
|
go runtime.EventsEmit(a.ctx, "newsPush", map[string]any{
|
||||||
"time": "新版本:" + releaseVersion.TagName,
|
"time": "新版本:" + releaseVersion.TagName,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user