| | |
| | | |
| | | from huaxin_client import socket_util |
| | | from huaxin_client.client_network import SendResponseSkManager |
| | | from log_module.log import logger_local_huaxin_trade_debug |
| | | from log_module import async_log_util |
| | | from log_module.log import logger_local_huaxin_trade_debug, logger_trade |
| | | |
| | | MSG_TYPE_HEART = "heart" |
| | | # 命令信息 |
| | |
| | | |
| | | try: |
| | | data = result_json["data"] |
| | | print("接收内容", result_json) |
| | | request_id = result_json.get('request_id') |
| | | if not socket_util.is_client_params_sign_right(result_json): |
| | | print("签名错误") |
| | | # 签名出错 |
| | | SendResponseSkManager.send_error_response(_type, request_id, client_id, |
| | | {"code": -1, "msg": "签名错误"}) |
| | | return |
| | | # 暂时取消签名 |
| | | # if not socket_util.is_client_params_sign_right(result_json): |
| | | # print("签名错误") |
| | | # # 签名出错 |
| | | # SendResponseSkManager.send_error_response(_type, request_id, client_id, |
| | | # {"code": -1, "msg": "签名错误"}) |
| | | # return |
| | | |
| | | if _type == CLIENT_TYPE_TRADE: |
| | | # 交易 |
| | | ctype = data["trade_type"] |
| | | async_log_util.info(logger_trade, f"交易开始") |
| | | cls.action_callback.OnTrade(client_id, request_id, sk, ctype, data) |
| | | async_log_util.info(logger_trade, f"交易结束") |
| | | elif _type == CLIENT_TYPE_MONEY: |
| | | cls.action_callback.OnMoney(client_id, request_id, sk) |
| | | elif _type == CLIENT_TYPE_DEAL_LIST: |
| | |
| | | val = pipe_strategy.recv() |
| | | if val: |
| | | val = json.loads(val) |
| | | print("run_process_command", val) |
| | | # print("run_process_command", val) |
| | | _type = val["type"] |
| | | threading.Thread(target=lambda: cls.process_command(_type, None, val), daemon=True).start() |
| | | except Exception as e: |