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

41 lines
1003 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"
2023-11-03 18:18:12 +08:00
"github.com/1Panel-dev/1Panel/backend/constant"
2022-11-23 17:44:24 +08:00
"github.com/1Panel-dev/1Panel/backend/global"
)
func Init() {
go syncApp()
go syncInstalledApp()
go syncRuntime()
2023-11-20 16:16:20 +08:00
go syncSSL()
}
func syncApp() {
2023-11-03 18:18:12 +08:00
_ = service.NewISettingService().Update("AppStoreSyncStatus", constant.SyncSuccess)
if err := service.NewIAppService().SyncAppListFromRemote(); err != nil {
global.LOG.Errorf("App Store synchronization failed")
return
}
}
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
}
}
func syncRuntime() {
if err := service.NewRuntimeService().SyncForRestart(); err != nil {
global.LOG.Errorf("sync runtime status error : %s", err.Error())
}
}
2023-11-20 16:16:20 +08:00
func syncSSL() {
if err := service.NewIWebsiteSSLService().SyncForRestart(); err != nil {
global.LOG.Errorf("sync ssl status error : %s", err.Error())
}
}