import policy
import tingtype
import BaseCore
from apscheduler.schedulers.blocking import BlockingScheduler

basecore = BaseCore.BaseCore()
log = basecore.getLogger()

def policylaw_task():
    # 实例化一个调度器
    scheduler = BlockingScheduler()
    # 每天执行一次
    scheduler.add_job(policy, 'cron', hour=0,minute=0)
    scheduler.add_job(tingtype, 'cron', hour=0, minute=0)
    try:
        scheduler.start()
    except Exception as e:
        log.info('定时采集异常', e)
        pass

policylaw_task()