1Panel/backend/init/business/business.go

36 lines
816 B
Go
Raw Normal View History

2022-11-23 17:44:24 +08:00
package business
import (
"github.com/1Panel-dev/1Panel/backend/app/service"
"github.com/1Panel-dev/1Panel/backend/global"
)
func Init() {
syncApp()
syncInstalledApp()
}
func syncApp() {
setting, err := service.NewISettingService().GetSettingInfo()
if err != nil {
global.LOG.Errorf("sync app error: %s", err.Error())
return
}
2023-02-17 16:21:13 +08:00
if setting.AppStoreVersion != "" {
global.LOG.Info("no need to sync")
return
}
global.LOG.Info("sync app start...")
if err := service.NewIAppService().SyncAppListFromRemote(); err != nil {
2022-11-23 17:44:24 +08:00
global.LOG.Errorf("sync app error: %s", err.Error())
return
}
global.LOG.Info("sync app successful")
}
func syncInstalledApp() {
if err := service.NewIAppInstalledService().SyncAll(true); err != nil {
global.LOG.Errorf("sync instaled app error: %s", err.Error())
2022-11-23 17:44:24 +08:00
}
}