From 1110af9cc42cbf6a3ebbb953f18585cb37ba5b8c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 08 一月 2024 15:24:35 +0800
Subject: [PATCH] bug修复/日志添加

---
 socket_manager.py |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/socket_manager.py b/socket_manager.py
index 9c64bd9..7ed312d 100644
--- a/socket_manager.py
+++ b/socket_manager.py
@@ -6,6 +6,7 @@
 
 class ClientSocketManager:
     # 瀹㈡埛绔被鍨�
+    CLIENT_TYPE_COMMON = "common"
     CLIENT_TYPE_TRADE = "trade"
 
     socket_client_dict = {}
@@ -14,7 +15,7 @@
 
     @classmethod
     def add_client(cls, _type, rid, sk):
-        if _type == cls.CLIENT_TYPE_TRADE:
+        if _type == cls.CLIENT_TYPE_COMMON or _type == cls.CLIENT_TYPE_TRADE:
             # 浜ゆ槗鍒楄〃
             if _type not in cls.socket_client_dict:
                 cls.socket_client_dict[_type] = []
@@ -26,7 +27,7 @@
 
     @classmethod
     def acquire_client(cls, _type):
-        if _type == cls.CLIENT_TYPE_TRADE:
+        if _type == cls.CLIENT_TYPE_COMMON or _type == cls.CLIENT_TYPE_TRADE:
             if _type in cls.socket_client_dict:
                 # 鏍规嵁鎺掑簭娲昏穬鏃堕棿鎺掑簭
                 client_list = sorted(cls.socket_client_dict[_type], key=lambda x: cls.active_client_dict.get(x[0]) if x[
@@ -96,8 +97,10 @@
                 cls.del_client(k)
 
     @classmethod
-    def list_client(cls):
-        _type = cls.CLIENT_TYPE_TRADE
+    def list_client(cls, type_=None):
+        _type = type_
+        if not _type:
+            _type = cls.CLIENT_TYPE_TRADE
         client_list = sorted(cls.socket_client_dict[_type],
                              key=lambda x: cls.active_client_dict.get(x[0]) if x[0] in cls.active_client_dict else 0,
                              reverse=True)
@@ -108,6 +111,5 @@
                 active_time = 0
             active_time = tool.to_time_str(int(active_time))
             fdata.append(
-                (client[0], cls.socket_client_lock_dict[client[0]].locked(),active_time))
+                (client[0], cls.socket_client_lock_dict[client[0]].locked(), active_time))
         return fdata
-

--
Gitblit v1.8.0