From fcd764d5214fefe3330936506d22a10fd5b1da13 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 9 May 2023 15:47:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BA=94=E7=94=A8=E5=95=86=E5=BA=97?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=94=B9=E4=B8=BA=E5=BC=82=E6=AD=A5=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=20(#956)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/api/v1/app.go | 17 +++++++++-------- frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + frontend/src/views/app-store/apps/index.vue | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/backend/app/api/v1/app.go b/backend/app/api/v1/app.go index 1ed5b009a..a23e272b7 100644 --- a/backend/app/api/v1/app.go +++ b/backend/app/api/v1/app.go @@ -38,14 +38,15 @@ func (b *BaseApi) SearchApp(c *gin.Context) { // @Router /apps/sync [post] // @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFuntions":[],"formatZH":"应用商店同步","formatEN":"App store synchronization"} func (b *BaseApi) SyncApp(c *gin.Context) { - appService.SyncAppListFromLocal() - global.LOG.Infof("sync app list start ...") - if err := appService.SyncAppListFromRemote(); err != nil { - global.LOG.Errorf("sync app list error [%s]", err.Error()) - helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err) - return - } - global.LOG.Infof("sync app list success!") + go appService.SyncAppListFromLocal() + go func() { + global.LOG.Infof("sync app list start ...") + if err := appService.SyncAppListFromRemote(); err != nil { + global.LOG.Errorf("sync app list error [%s]", err.Error()) + } else { + global.LOG.Infof("sync app list success!") + } + }() helper.SuccessWithData(c, "") } diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 637100738..7dd686b35 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1045,6 +1045,7 @@ const message = { updateHelper: 'Updating parameters may cause the application to fail to start, please operate with caution', updateWarn: 'Update parameters need to rebuild the application, Do you want to continue? ', busPort: 'Service Port', + syncStart: 'Start syncing! Please refresh the app store later', }, website: { website: 'Website', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 2e2ca9774..4f2b3756c 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1048,6 +1048,7 @@ const message = { updateHelper: '更新参数可能导致应用无法启动,请提前备份并谨慎操作', updateWarn: '更新参数需要重建应用,是否继续?', busPort: '服务端口', + syncStart: '开始同步!请稍后刷新应用商店', }, website: { website: '网站', diff --git a/frontend/src/views/app-store/apps/index.vue b/frontend/src/views/app-store/apps/index.vue index 88b6e877e..8218e040d 100644 --- a/frontend/src/views/app-store/apps/index.vue +++ b/frontend/src/views/app-store/apps/index.vue @@ -147,7 +147,7 @@ const sync = () => { loading.value = true; SyncApp() .then(() => { - MsgSuccess(i18n.global.t('app.syncSuccess')); + MsgSuccess(i18n.global.t('app.syncStart')); canUpdate.value = false; search(req); })