2023-02-09 22:18:06 +03:00
|
|
|
package job
|
|
|
|
|
|
|
|
import (
|
|
|
|
"x-ui/web/service"
|
|
|
|
)
|
|
|
|
|
|
|
|
type LoginStatus byte
|
|
|
|
|
|
|
|
const (
|
|
|
|
LoginSuccess LoginStatus = 1
|
|
|
|
LoginFail LoginStatus = 0
|
|
|
|
)
|
|
|
|
|
|
|
|
type StatsNotifyJob struct {
|
2023-03-17 19:07:49 +03:00
|
|
|
xrayService service.XrayService
|
|
|
|
tgbotService service.Tgbot
|
2023-02-09 22:18:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewStatsNotifyJob() *StatsNotifyJob {
|
|
|
|
return new(StatsNotifyJob)
|
|
|
|
}
|
|
|
|
|
2023-02-18 15:37:32 +03:00
|
|
|
// Here run is a interface method of Job interface
|
2023-02-09 22:18:06 +03:00
|
|
|
func (j *StatsNotifyJob) Run() {
|
|
|
|
if !j.xrayService.IsXrayRunning() {
|
|
|
|
return
|
|
|
|
}
|
2023-03-17 19:07:49 +03:00
|
|
|
j.tgbotService.SendReport()
|
2023-02-09 22:18:06 +03:00
|
|
|
}
|