integrate core codes

This commit is contained in:
Alireza Ahmadi
2024-12-16 00:12:09 +01:00
parent f1b6c8a131
commit ecd9348a0f
22 changed files with 1528 additions and 424 deletions
+6 -2
View File
@@ -1,6 +1,7 @@
package cronjob
import (
"s-ui/core"
"time"
"github.com/robfig/cron/v3"
@@ -8,10 +9,13 @@ import (
type CronJob struct {
cron *cron.Cron
Core *core.Core
}
func NewCronJob() *CronJob {
return &CronJob{}
func NewCronJob(c *core.Core) *CronJob {
return &CronJob{
Core: c,
}
}
func (c *CronJob) Start(loc *time.Location, trafficAge int) error {
+3 -3
View File
@@ -6,15 +6,15 @@ import (
)
type StatsJob struct {
service.SingBoxService
service.StatsService
}
func NewStatsJob() *StatsJob {
return new(StatsJob)
return &StatsJob{}
}
func (s *StatsJob) Run() {
err := s.SingBoxService.GetStats()
err := s.StatsService.SaveStats()
if err != nil {
logger.Warning("Get stats failed: ", err)
return