| | |
| | | cls.pipe_l2 = pipe_l2 |
| | | |
| | | @classmethod |
| | | def __process_command(cls, _type, client_id, result_json): |
| | | def process_command(cls, _type, client_id, result_json): |
| | | try: |
| | | data = result_json["data"] |
| | | print("接收内容", result_json) |
| | |
| | | elif _type == "test": |
| | | cls.action_callback.OnTest(client_id, request_id, data) |
| | | except Exception as e: |
| | | logger_local_huaxin_trade_debug.debug(f"__process_command出错:{result_json}") |
| | | logger_local_huaxin_trade_debug.debug(f"process_command出错:{result_json}") |
| | | logging.exception(e) |
| | | logging.error(result_json) |
| | | |
| | |
| | | if pipe_strategy is None: |
| | | return |
| | | # 本地命令接收 |
| | | while True: |
| | | try: |
| | | val = pipe_strategy.recv() |
| | | if val: |
| | | val = json.loads(val) |
| | | print("run_process_command", val) |
| | | _type = val["type"] |
| | | _data = val["data"] |
| | | # 查看是否是设置L2的代码 |
| | | if _type == CLIENT_TYPE_CMD_L2: |
| | | cls.pipe_l2.send( |
| | | json.dumps({"type": "set_l2_codes", "data": _data})) |
| | | else: |
| | | threading.Thread(target=lambda: cls.__process_command(_type, None, val), daemon=True).start() |
| | | except Exception as e: |
| | | logger_local_huaxin_trade_debug.exception(e) |
| | | logging.exception(e) |
| | | try: |
| | | while True: |
| | | try: |
| | | val = pipe_strategy.recv() |
| | | if val: |
| | | val = json.loads(val) |
| | | print("run_process_command", val) |
| | | _type = val["type"] |
| | | _data = val["data"] |
| | | # 查看是否是设置L2的代码 |
| | | if _type == CLIENT_TYPE_CMD_L2: |
| | | cls.pipe_l2.send( |
| | | json.dumps({"type": "set_l2_codes", "data": _data})) |
| | | else: |
| | | threading.Thread(target=lambda: cls.process_command(_type, None, val), daemon=True).start() |
| | | except Exception as e: |
| | | logger_local_huaxin_trade_debug.exception(e) |
| | | logging.exception(e) |
| | | except Exception as e: |
| | | logger_local_huaxin_trade_debug.exception(e) |
| | | |
| | | # 维护连接数的稳定 |
| | | def run(self, blocking=True): |