init: 1.0.0

This commit is contained in:
Chang lue Tsen
2025-04-25 12:08:29 +09:00
commit 8addcc584b
1031 changed files with 76472 additions and 0 deletions
@@ -0,0 +1,35 @@
package tool
import (
"context"
"github.com/perfect-panel/ppanel-server/internal/svc"
"github.com/perfect-panel/ppanel-server/pkg/logger"
)
type RestartSystemLogic struct {
logger.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
// Restart System
func NewRestartSystemLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RestartSystemLogic {
return &RestartSystemLogic{
Logger: logger.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *RestartSystemLogic) RestartSystem() error {
l.Logger.Info("[RestartSystem]", logger.Field("info", "Restarting system"))
go func() {
err := l.svcCtx.Restart()
if err != nil {
l.Errorw("[RestartSystem]", logger.Field("error", err.Error()))
}
l.Logger.Info("[RestartSystem]", logger.Field("info", "System restarted"))
}()
return nil
}