2020-07-28 19:45:38 +08:00
|
|
|
import os
|
|
|
|
|
2021-10-30 01:10:26 +08:00
|
|
|
from module.config.config import TaskEnd
|
2022-01-10 00:13:00 +08:00
|
|
|
from module.event.base import EventBase
|
2020-07-28 19:45:38 +08:00
|
|
|
from module.logger import logger
|
|
|
|
|
|
|
|
|
2022-01-10 00:13:00 +08:00
|
|
|
class CampaignSP(EventBase):
|
|
|
|
def run(self, *args, **kwargs):
|
2021-10-03 22:14:30 +08:00
|
|
|
if not os.path.exists(f'./campaign/{self.config.Campaign_Event}/sp.py'):
|
|
|
|
logger.info(f'./campaign/{self.config.Campaign_Event}/sp.py not exists')
|
|
|
|
logger.info(f'This event do not have SP, skip')
|
|
|
|
self.config.Scheduler_Enable = False
|
|
|
|
self.config.task_stop()
|
2022-01-07 00:19:52 +08:00
|
|
|
|
2021-10-30 01:10:26 +08:00
|
|
|
try:
|
|
|
|
super().run(name=self.config.Campaign_Name, folder=self.config.Campaign_Event, total=1)
|
|
|
|
except TaskEnd:
|
|
|
|
# Catch task switch
|
|
|
|
pass
|
2021-10-03 22:14:30 +08:00
|
|
|
if self.run_count > 0:
|
|
|
|
self.config.task_delay(server_update=True)
|
2020-07-28 19:45:38 +08:00
|
|
|
else:
|
2021-10-03 22:14:30 +08:00
|
|
|
self.config.task_stop()
|