feat: 应用商店同步改为异步操作 (#956)

pull/960/head
zhengkunwang223 2023-05-09 15:47:43 +08:00 committed by GitHub
parent 7d4a8782d8
commit fcd764d521
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 9 deletions

View File

@ -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, "")
}

View File

@ -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',

View File

@ -1048,6 +1048,7 @@ const message = {
updateHelper: '',
updateWarn: '',
busPort: '',
syncStart: '',
},
website: {
website: '',

View File

@ -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);
})