#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Time : 2020/9/25 13:36 @Author : zhengwangeng @Software: PyCharm # code is far away from bugs with the god animal protecting I love animals. They taste delicious. ┏┓ ┏┓ ┏┛┻━━━┛┻┓ ┃ ☃ ┃ ┃ ┳┛ ┗┳ ┃ ┃ ┻ ┃ ┗━┓ ┏━┛ ┃ ┗━━━┓ ┃ 神兽保佑 ┣┓ ┃ 永无BUG! ┏┛ ┗┓┓┏━┳┓┏┛ ┃┫┫ ┃┫┫ ┗┻┛ ┗┻┛ """ import time from apscheduler.schedulers.blocking import BlockingScheduler from logger import LoggerService # import account_list as al def start_order_job(log): log.info('start_order_job') # log.info(len(al.yuewen_account_list)) st_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600) et_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600) # print(st_unix, et_unix) st_unix = 1600736400; et_unix = 1600740000; # print(st_unix, et_unix) # et_unix = et_unix - 1 st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00' et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00' # log.info(st_dt + '\t' + et_dt) start_order_time = '2020-09-21 16:05:00' start_cost_time = '2020-09-21 16:35:00' if __name__ == '__main__': log = LoggerService.logger_file('abc.log', 'abcd') st_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600) et_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600) now_unix = int((time.time() + 8 * 3600) // 86400 * 86400 - 8 * 3600) log.info(st_unix) log.info(et_unix) log.info(now_unix) st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00' et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00' now_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(now_unix)) + '+08:00' log.info(st_dt) log.info(et_dt) log.info(now_dt) data = (int((time.time() + 8 * 3600) // 86400 * 86400 - 8 * 3600)) log.info(data) scheduler = BlockingScheduler() scheduler.add_job(start_order_job, args=(log,), trigger='interval', max_instances=10, seconds=10, start_date=start_order_time) scheduler.start()