test.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. @Time : 2020/9/25 13:36
  5. @Author : zhengwangeng
  6. @Software: PyCharm
  7. # code is far away from bugs with the god animal protecting
  8. I love animals. They taste delicious.
  9. ┏┓ ┏┓
  10. ┏┛┻━━━┛┻┓
  11. ┃ ☃ ┃
  12. ┃ ┳┛ ┗┳ ┃
  13. ┃ ┻ ┃
  14. ┗━┓ ┏━┛
  15. ┃ ┗━━━┓
  16. ┃ 神兽保佑 ┣┓
  17. ┃ 永无BUG! ┏┛
  18. ┗┓┓┏━┳┓┏┛
  19. ┃┫┫ ┃┫┫
  20. ┗┻┛ ┗┻┛
  21. """
  22. import time
  23. from apscheduler.schedulers.blocking import BlockingScheduler
  24. from logger import LoggerService
  25. # import account_list as al
  26. def start_order_job(log):
  27. log.info('start_order_job')
  28. # log.info(len(al.yuewen_account_list))
  29. st_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600)
  30. et_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600)
  31. # print(st_unix, et_unix)
  32. st_unix = 1600736400;
  33. et_unix = 1600740000;
  34. # print(st_unix, et_unix)
  35. # et_unix = et_unix - 1
  36. st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00'
  37. et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00'
  38. # log.info(st_dt + '\t' + et_dt)
  39. start_order_time = '2020-09-21 16:05:00'
  40. start_cost_time = '2020-09-21 16:35:00'
  41. if __name__ == '__main__':
  42. log = LoggerService.logger_file('abc.log', 'abcd')
  43. st_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600 - 3600)
  44. et_unix = int((time.time() + 8 * 3600) // 3600 * 3600 - 8 * 3600)
  45. now_unix = int((time.time() + 8 * 3600) // 86400 * 86400 - 8 * 3600)
  46. log.info(st_unix)
  47. log.info(et_unix)
  48. log.info(now_unix)
  49. st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00'
  50. et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00'
  51. now_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(now_unix)) + '+08:00'
  52. log.info(st_dt)
  53. log.info(et_dt)
  54. log.info(now_dt)
  55. data = (int((time.time() + 8 * 3600) // 86400 * 86400 - 8 * 3600))
  56. log.info(data)
  57. scheduler = BlockingScheduler()
  58. scheduler.add_job(start_order_job, args=(log,), trigger='interval', max_instances=10, seconds=10,
  59. start_date=start_order_time)
  60. scheduler.start()