constant.py | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
huaxin_client/huaxin_trade_client.py | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
trade/huaxin_trade_api.py | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
constant.py
@@ -16,6 +16,7 @@ LOG_DIR = "logs_simulation" # 获取根路径 def get_path_prefix(): return 'D:' if is_windows() else '/home/userzjj' huaxin_client/huaxin_trade_client.py
@@ -65,6 +65,7 @@ self.call_back_thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=10) def OnFrontConnected(self) -> "void": print("OnFrontConnected") # 获取终端信息 TradeSimpleApi.req_id += 1 @@ -78,6 +79,7 @@ def OnRspGetConnectionInfo(self, pConnectionInfoField: "CTORATstpConnectionInfoField", pRspInfoField: "CTORATstpRspInfoField", nRequestID: "int") -> "void": print("OnRspGetConnectionInfo") if pRspInfoField.ErrorID == 0: logger.info('inner_ip_address[%s]' % pConnectionInfoField.InnerIPAddress) logger.info('inner_port[%d]' % pConnectionInfoField.InnerPort) @@ -134,6 +136,7 @@ def OnRspUserLogin(self, pRspUserLoginField: "CTORATstpRspUserLoginField", pRspInfoField: "CTORATstpRspInfoField", nRequestID: "int") -> "void": print("OnRspUserLogin") if pRspInfoField.ErrorID == 0: logger_system.info('Login success! [%d]' % nRequestID) self.__front_id = pRspUserLoginField.FrontID trade/huaxin_trade_api.py
@@ -10,6 +10,8 @@ import time import concurrent.futures import requests from utils import socket_util, tool __response_thread_pool = concurrent.futures.ThreadPoolExecutor(max_workers=15) @@ -23,6 +25,9 @@ return # 设置响应内容 set_response(data_json["request_id"], data_json['data']) def __send_to_trade_server(data_str): requests.post("http://183.234.94.164:12881/trade_callback", data_str) if queue is not None: while True: @@ -41,7 +46,8 @@ try: # 交易回调 data_json = data_json["data"] ctype = data_json["type"] # 将交易回调传递给交易服务器 __response_thread_pool.submit(__send_to_trade_server, val) # 记录交易反馈日志 finally: pass @@ -320,4 +326,4 @@ if __name__ == "__main__": pass requests.post("http://192.168.3.241:12881/trade_callback", json.dumps({"code":"123123"}))