stats_notify_job.go 471 B

1234567891011121314151617181920212223242526272829
  1. package job
  2. import (
  3. "x-ui/web/service"
  4. )
  5. type LoginStatus byte
  6. const (
  7. LoginSuccess LoginStatus = 1
  8. LoginFail LoginStatus = 0
  9. )
  10. type StatsNotifyJob struct {
  11. xrayService service.XrayService
  12. tgbotService service.Tgbot
  13. }
  14. func NewStatsNotifyJob() *StatsNotifyJob {
  15. return new(StatsNotifyJob)
  16. }
  17. // Here run is a interface method of Job interface
  18. func (j *StatsNotifyJob) Run() {
  19. if !j.xrayService.IsXrayRunning() {
  20. return
  21. }
  22. j.tgbotService.SendReport()
  23. }