test.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. __title__ = '测试类'
  5. @Time : 2020/9/24 19:44
  6. @Author : Kenny-PC
  7. @Software: PyCharm
  8. # code is far away from bugs with the god animal protecting
  9. I love animals. They taste delicious.
  10. ┏┓ ┏┓
  11. ┏┛┻━━━┛┻┓
  12. ┃ ☃ ┃
  13. ┃ ┳┛ ┗┳ ┃
  14. ┃ ┻ ┃
  15. ┗━┓ ┏━┛
  16. ┃ ┗━━━┓
  17. ┃ 神兽保佑 ┣┓
  18. ┃ 永无BUG! ┏┛
  19. ┗┓┓┏━┳┓┏┛
  20. ┃┫┫ ┃┫┫
  21. ┗┻┛ ┗┻┛
  22. """
  23. import time
  24. from LoggerService import LoggerService
  25. # import account_list as al
  26. from util import date_util,platform_util
  27. def start_order_job(log):
  28. log.info('start_order_job')
  29. start_order_time = '2020-09-21 16:05:00'
  30. start_cost_time = '2020-09-21 16:35:00'
  31. if __name__ == '__main__':
  32. log = LoggerService.logger_file('abc.log', 'abcd')
  33. print(date_util.getYesterdayStartTime(), platform_util.getZzyQueryTime(date_util.getYesterdayStartTime()))
  34. request_time_stamp = time.time()
  35. st_unix = int((request_time_stamp + 8 * 3600) // 86400 * 86400 - 8 * 3600 - 86400)
  36. et_unix = int((request_time_stamp + 8 * 3600) // 86400 * 86400 - 8 * 3600)
  37. st_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(st_unix)) + '+08:00'
  38. et_dt = time.strftime("%Y-%m-%dT%H:%M:%S", time.localtime(et_unix)) + '+08:00'
  39. print(st_unix, st_dt)
  40. print(et_unix, et_dt)
  41. print('时间转换')
  42. print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(date_util.getYesterdayStartTime())))
  43. print(date_util.getCurrentSecondTime())
  44. print(date_util.getSecondsToDatetime())
  45. print(date_util.getSecondsToDatetime(date_util.getYesterdayStartTime()))
  46. print(date_util.getSecondsToDatetime(date_util.getYesterdayStartTime(), "%Y-%m-%d %H:%M:%S"))
  47. # sql = "select * from quchen_text.order where date=1600790400"
  48. # connect = MySQLConnection('test')
  49. # try:
  50. # page = 1
  51. # size = 50
  52. # pagination = connect.listByPage(sql, page, size)
  53. # print(pagination)
  54. # except Exception as e:
  55. # log.exception(e)
  56. # finally:
  57. # # 关闭数据库连接
  58. # connect.close()
  59. # scheduler = BlockingScheduler()
  60. # scheduler.add_job(start_order_job, args=(log,), trigger='interval', max_instances=10, seconds=10,
  61. # start_date=start_order_time)
  62. # scheduler.start()