Browse Source

fix: 解决本地应用升级失败的问题 (#1248)

pull/1251/head
zhengkunwang223 1 year ago committed by GitHub
parent
commit
5e7524e4f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Makefile
  2. 3
      backend/app/service/app.go
  3. 15
      backend/app/service/app_utils.go
  4. 3
      frontend/src/views/app-store/installed/index.vue

2
Makefile

@ -34,3 +34,5 @@ build_backend_on_archlinux:
&& CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w --extldflags "-fpic"' -tags osusergo -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
build_all: build_frontend build_backend_on_linux
build_on_local: clean_asserts build_frontend build_backend_on_darwin upx_bin

3
backend/app/service/app.go

@ -354,9 +354,6 @@ func (a AppService) Install(ctx context.Context, req request.AppInstallCreate) (
if err = upAppPre(app, appInstall); err != nil {
return
}
go func() {
_, _ = http.Get(appDetail.DownloadCallBackUrl)
}()
upApp(appInstall)
}()
go updateToolApp(appInstall)

15
backend/app/service/app_utils.go

@ -242,11 +242,15 @@ func upgradeInstall(installId uint, detailId uint) error {
}
}()
if upErr = downloadApp(install.App, detail, &install); upErr != nil {
return
}
detailDir := path.Join(constant.ResourceDir, "apps", install.App.Resource, install.App.Key, detail.Version)
if install.App.Resource == constant.AppResourceRemote {
if upErr = downloadApp(install.App, detail, &install); upErr != nil {
return
}
go func() {
_, _ = http.Get(detail.DownloadCallBackUrl)
}()
}
if install.App.Resource == constant.AppResourceLocal {
detailDir = path.Join(constant.ResourceDir, "apps", "local", strings.TrimPrefix(install.App.Key, "local"), detail.Version)
}
@ -462,6 +466,9 @@ func copyData(app model.App, appDetail model.AppDetail, appInstall *model.AppIns
if err != nil {
return
}
go func() {
_, _ = http.Get(appDetail.DownloadCallBackUrl)
}()
}
appKey := app.Key
installAppDir := path.Join(constant.AppInstallDir, app.Key)

3
frontend/src/views/app-store/installed/index.vue

@ -169,7 +169,8 @@
round
size="small"
:disabled="
installed.status !== 'Running' ||
(installed.status !== 'Running' &&
installed.status !== 'UpgradeErr') ||
installed.app.status === 'TakeDown'
"
@click="openOperate(installed, 'upgrade')"

Loading…
Cancel
Save