corp1031
This commit is contained in:
+16
-6
@@ -2,7 +2,7 @@ import requests
|
||||
import time
|
||||
from applog import logger
|
||||
import requests
|
||||
import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from ewcc2 import Sinopec_ewcc
|
||||
|
||||
|
||||
@@ -165,6 +165,8 @@ def save_param4(param4_value):
|
||||
def main():
|
||||
logger.info("查询处理代码启动")
|
||||
ewcc = Sinopec_ewcc()
|
||||
# 记录上一次执行代码B的时间
|
||||
last_b_execution = datetime.now()
|
||||
i =0
|
||||
# 主循环
|
||||
while True:
|
||||
@@ -181,7 +183,15 @@ def main():
|
||||
ewcc.quit( )
|
||||
ewcc=Sinopec_ewcc()
|
||||
continue
|
||||
|
||||
|
||||
# 循环执行A和B函数,每小时切换一次
|
||||
if datetime.now() - last_b_execution >= timedelta(hours=1):
|
||||
# 执行A函数
|
||||
logger.info("每一小时重启下 浏览器")
|
||||
ewcc.reset()
|
||||
# 重置计时器
|
||||
last_b_execution = datetime.now()
|
||||
|
||||
# 自动登录
|
||||
if not ewcc.Autologin(parameters['param1'],parameters['param2'],parameters['param3'],parameters['param4']):
|
||||
time.sleep(30)
|
||||
@@ -194,22 +204,22 @@ def main():
|
||||
ewcc.today_is_export_date()
|
||||
|
||||
# 查询员工拉新权益会员明细
|
||||
if not ewcc.is_query_member and datetime.datetime.now().hour >= 3:
|
||||
if not ewcc.is_query_member and datetime.now().hour >= 6:
|
||||
logger.info("开始查询员工拉新权益会员明细")
|
||||
ewcc.is_query_member=ewcc.query_memeber()
|
||||
|
||||
# 查询员工拉新权益会员明细
|
||||
if not ewcc.is_query_oil_fw_tj and datetime.datetime.now().hour >= 3:
|
||||
if not ewcc.is_query_oil_fw_tj and datetime.now().hour >= 6:
|
||||
logger.info("开始查询油站服务号应用统计")
|
||||
ewcc.is_query_oil_fw_tj=ewcc.query_oil_fw_tj()
|
||||
|
||||
# 查询油站汇总本月累计
|
||||
if not ewcc.is_query_oil_current_month_lj and datetime.datetime.now().hour >= 3:
|
||||
if not ewcc.is_query_oil_current_month_lj and datetime.now().hour >= 6:
|
||||
logger.info("开始查询 按油站汇总本月累计")
|
||||
ewcc.is_query_oil_current_month_lj=ewcc.query_oil_current_month_lj()
|
||||
|
||||
# 查询客户评价与员工关联统计
|
||||
if not ewcc.is_query_client_emp_tj and datetime.datetime.now().hour >= 3:
|
||||
if not ewcc.is_query_client_emp_tj and datetime.now().hour >= 6:
|
||||
logger.info("开始查询客户评价与员工关联统计")
|
||||
ewcc.is_query_client_emp_tj=ewcc.query_client_emp_tj()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user