corp0924
This commit is contained in:
+13
-11
@@ -14,7 +14,7 @@ logging.basicConfig(
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# API基础URL
|
||||
BASE_URL = 'http://localhost:99'
|
||||
BASE_URL = 'http://10.190.20.156:99'
|
||||
|
||||
# 演示数据处理函数
|
||||
def process_query_data(query_data, parameters):
|
||||
@@ -52,7 +52,7 @@ def get_parameters():
|
||||
data = response.json()
|
||||
|
||||
if data['success']:
|
||||
logger.info(f"成功获取参数配置: {data['data']}")
|
||||
logger.info(f"成功获取参数配置: ")
|
||||
return data['data']
|
||||
else:
|
||||
logger.error(f"获取参数配置失败: {data['error']}")
|
||||
@@ -166,11 +166,9 @@ def save_param4(param4_value):
|
||||
# 主处理函数
|
||||
def main():
|
||||
logger.info("查询处理代码启动")
|
||||
|
||||
|
||||
ewcc = Sinopec_ewcc()
|
||||
# 主循环
|
||||
while True:
|
||||
ewcc = Sinopec_ewcc()
|
||||
|
||||
try:
|
||||
# 获取参数配置
|
||||
@@ -180,7 +178,11 @@ def main():
|
||||
time.sleep(30)
|
||||
continue
|
||||
|
||||
# 登录浏览器
|
||||
# 判断当前连接状态,重新连接
|
||||
if not ewcc.browser.states.is_alive:
|
||||
ewcc.browser.reconnect()
|
||||
|
||||
# 自动登录
|
||||
if not ewcc.Autologin(parameters['param1'],parameters['param2'],parameters['param3'],parameters['param4']):
|
||||
time.sleep(30)
|
||||
continue
|
||||
@@ -192,12 +194,9 @@ def main():
|
||||
pending_queries = get_pending_queries()
|
||||
|
||||
# 处理每条查询
|
||||
ewcc.query_car_info("湘AB5W21")
|
||||
for query in pending_queries:
|
||||
# 处理查询数据
|
||||
rtn_cars_info=ewcc.query_car_info(query['plate_number'],query['phone'])
|
||||
#results_count = process_query_data(query, parameters)
|
||||
|
||||
rtn_cars_info=ewcc.query_car_info(query['plate_number'],query['phone'])
|
||||
# 更新查询结果
|
||||
update_query_result(query['id'], len(rtn_cars_info), rtn_cars_info)
|
||||
|
||||
@@ -220,8 +219,11 @@ def main():
|
||||
logger.error(f"处理过程中发生错误: {str(e)}")
|
||||
# 发生错误时,等待更短的时间后重试
|
||||
time.sleep(30)
|
||||
|
||||
|
||||
logger.info("查询处理器停止")
|
||||
if ewcc:
|
||||
ewcc.quit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user