Browse Source

Merge branch 'ZJZGJ' of http://www.sri-robot.cn:30000/SRI-DINO/Server-py into ZJZGJ

Casper 4 months ago
parent
commit
ae59074717
3 changed files with 21 additions and 16 deletions
  1. 3 2
      sri-pysdk/xlib/xlog.py
  2. 11 11
      sri-server-bg01/test/test-1000.py
  3. 7 3
      sri-server-bg03/lib/Connection_e1.py

+ 3 - 2
sri-pysdk/xlib/xlog.py

@@ -1,6 +1,7 @@
 # update: 2022-4-19
 import logging
 import traceback
+import datetime
 
 LOG = logging.getLogger(__name__)
 # logging.basicConfig(format='%(levelname)s | %(asctime)s | %(module)s.%(funcName)s:%(lineno)s >>> %(message)s',
@@ -18,8 +19,8 @@ def debug_log(tags, args, is_work=True, show_level=logging.INFO):
             lines += f"\n- {count + 1} - {line}"
         LOG.info(lines)
     elif type(args) == str:
-        now_string = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
-        LOG.info(f"{now_string} | {tags} | {args}")
+        now_string = datetime.datetime.now().strftime('%Y-%m-%d-%H:%M:%S')
+        LOG.info(f"{now_string}|{tags} | {args}")
         # LOG.info(f"{tags} | {args}")
 
 

+ 11 - 11
sri-server-bg01/test/test-1000.py

@@ -53,17 +53,17 @@ print(response.json())
 
 # --- test 1002 查询用户列表 ---
 # url = 'http://58.34.94.177:29101/v6/api'
-url = 'http://127.0.0.1:9000/v6/api'
-data = {
-    'code': 1002,  # 接口号
-    'page': 1,  # 页码
-    'size': 3,  # 每页条数
-    'name': '张',  # 模糊姓名(可选项)
-    'phone': '',  # 手机号(可选项)
-    'role_type': ['1'],  # 角色类型(可选项) 1 超级管理员 2 普通管理员 3 普通用户(默认值)
-}
-response = requests.post(url=url, json=data, headers={'authorization': token})
-print(response.json())
+# url = 'http://127.0.0.1:9000/v6/api'
+# data = {
+#     'code': 1002,  # 接口号
+#     'page': 1,  # 页码
+#     'size': 3,  # 每页条数
+#     'name': '张',  # 模糊姓名(可选项)
+#     'phone': '',  # 手机号(可选项)
+#     'role_type': ['1'],  # 角色类型(可选项) 1 超级管理员 2 普通管理员 3 普通用户(默认值)
+# }
+# response = requests.post(url=url, json=data, headers={'authorization': token})
+# print(response.json())
 # """
 # {
 #   'code': 0,

+ 7 - 3
sri-server-bg03/lib/Connection_e1.py

@@ -72,7 +72,8 @@ class SRIConnection(asyncio.Protocol):
         """
         关闭连接
         """
-        methods.debug_log(f"{self.connection_id}|SRIConnection085", f"连接已关闭")
+        methods.debug_log(f"{self.connection_id}|SRIConnection|65", f"连接已关闭")
+        methods.debug_log(f"{self.connection_id}|SRIConnection|65", f"clients: len{clients}")
 
         # --- get VehicleStatus ---
         unique_dict = {'name': 'VehicleStatus'}
@@ -182,8 +183,11 @@ class SRIConnection(asyncio.Protocol):
                 head_data = self.message_data[:self.head_size]
                 command_id, body_length = struct.unpack(self.head_sequence, head_data)
                 if command_id not in [2008]:
-                    methods.debug_log(f'{self.connection_id}|SRIConnection176',
+                    methods.debug_log(f'{self.connection_id}|SRIConnection.166',
                                       f"command_id: {command_id}, body_length: {body_length}")
+                # else:
+                #     methods.debug_log(f'{self.connection_id}|SRIConnection.169',
+                #                       f"command_id: {command_id}, body_length: {body_length}")
 
                 # 检查命令ID是否有效
                 if not (1000 < command_id < 9000):
@@ -569,7 +573,7 @@ class SRIConnection(asyncio.Protocol):
 
     def message2007(self, body_data):
 
-        # --- 解析消息体
+        # --- 解析消息体 2007
         """
         Leave: 消息体
         Leave.peer: int32(车端rid)