From 01fd0dc91fbb9defcd5aa90635754befdc71dfd1 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期二, 22 八月 2023 16:31:02 +0800 Subject: [PATCH] 添加托管交易通道测试 --- trade/huaxin/trade_server.py | 3 ++- outside_api_command_manager.py | 5 +++-- utils/data_export_util.py | 5 +---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/outside_api_command_manager.py b/outside_api_command_manager.py index 03c80c0..958a99c 100644 --- a/outside_api_command_manager.py +++ b/outside_api_command_manager.py @@ -11,6 +11,7 @@ # 蹇冭烦淇℃伅 from huaxin_client import socket_util from huaxin_client.client_network import SendResponseSkManager +from log_module.log import logger_debug from utils import middle_api_protocol MSG_TYPE_HEART = "heart" @@ -206,8 +207,8 @@ def __heart_beats(cls, _type, client_id, sk): while True: try: - sk.send(SendResponseSkManager.format_response( - json.dumps({"type": "heart", "client_id": client_id}).encode('utf-8'))) + sk.send(socket_util.load_header(json.dumps({"type": "heart", "client_id": client_id}).encode('utf-8'))) + logger_debug.debug("蹇冭烦淇℃伅鍙戦�侊細{}",client_id) # print("蹇冭烦淇℃伅鍙戦�佹垚鍔�", client_id) except Exception as e: logging.error("閿欒") diff --git a/trade/huaxin/trade_server.py b/trade/huaxin/trade_server.py index a2fd2b1..90c7787 100644 --- a/trade/huaxin/trade_server.py +++ b/trade/huaxin/trade_server.py @@ -565,7 +565,8 @@ def OnExportL2(self, client_id, request_id, data): try: code = data["code"] - data_export_util.export_l2_excel(code) + excel_file_name = data_export_util.export_l2_excel(code) + print("瀵煎嚭L2鏁版嵁鐩綍锛�",excel_file_name) self.send_response({"code": 0, "data": {}, "msg": ""}, client_id, request_id) except Exception as e: self.send_response({"code": 1, "msg": str(e)}, client_id, request_id) diff --git a/utils/data_export_util.py b/utils/data_export_util.py index 4ef3bec..73d86f3 100644 --- a/utils/data_export_util.py +++ b/utils/data_export_util.py @@ -50,12 +50,9 @@ local_time = time.strftime("%Y%m%dT%H%M%S", time.localtime(time.time())) file_name = "{}/{}_{}.xls".format(dest_dir, code, local_time) file_name_txt = "{}/{}_{}.txt".format(dest_dir, code, local_time) - openfile = open(file_name_txt, 'w') - try: + with open(file_name_txt, 'w') as openfile: for data in datas: openfile.write(json.dumps(data) + "\n") - finally: - openfile.close() wb = xlwt.Workbook(encoding="utf-8") ws = wb.add_sheet('sheet1') ws.write(0, 0, '搴忓彿') -- Gitblit v1.8.0