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