casper 1 month ago
parent
commit
ead89a605b

+ 2 - 2
sri-server-bg02/lib/MessageListenerC001.py

@@ -89,8 +89,8 @@ def method_c001(client, userdata, message):
     vehicle_id = log_dict.get('vehicleID')
     vehicle_id = log_dict.get('vehicleID')
     cockpit_id = log_dict.get('cockpitID')
     cockpit_id = log_dict.get('cockpitID')
     log_uuid = UserWorkRecord.get_log_uuid(user_uuid, log_time, vehicle_id, cockpit_id)
     log_uuid = UserWorkRecord.get_log_uuid(user_uuid, log_time, vehicle_id, cockpit_id)
-    # methods.debug_log(f"method_c001|92", f"user_uuid: {user_uuid}, log_time: {log_time}")
     if not log_uuid:
     if not log_uuid:
+        methods.debug_log(f"MessageListenerC001|error92", f"user_uuid: {user_uuid}, log_time: {log_time}")
         return
         return
 
 
     # --- fill log_list ---
     # --- fill log_list ---
@@ -154,8 +154,8 @@ def method_c001(client, userdata, message):
     LocalClass.last_log_key = log_key
     LocalClass.last_log_key = log_key
 
 
     # --- save ---
     # --- save ---
+    # methods.debug_log(f"MessageListenerC001|158", f"#log_list: {log_list}")
     log_file_path = os.path.join(save_dir, f'{log_uuid}.log')
     log_file_path = os.path.join(save_dir, f'{log_uuid}.log')
-    methods.debug_log(f"MessageListenerC001|158", f"#log_list: {log_list}")
     methods.write_text(log_file_path, ' | '.join(log_list) + '\n', 'a')
     methods.write_text(log_file_path, ' | '.join(log_list) + '\n', 'a')
 
 
 
 

+ 7 - 2
sri-server-bg02/lib/MessageListenerV001.py

@@ -44,8 +44,13 @@ def method_v001(client, userdata, message):
         methods.debug_log("method_v001|41", f"#traceback: {traceback.format_exc()}")
         methods.debug_log("method_v001|41", f"#traceback: {traceback.format_exc()}")
         return
         return
 
 
-    # --- fill log_list ---
+    # --- check ---
     log_uuid = UserWorkRecord.get_log_uuid(user_uuid, log_time, vehicle_id, cockpit_id)
     log_uuid = UserWorkRecord.get_log_uuid(user_uuid, log_time, vehicle_id, cockpit_id)
+    if not log_uuid:
+        methods.debug_log(f"MessageListenerV001|error50", f"user_uuid: {user_uuid}, log_time: {log_time}")
+        return
+
+    # --- fill log_list ---
     log_list = [
     log_list = [
 
 
         f"timestamp: {methods.ts_to_string(log_time)}",  # 时间
         f"timestamp: {methods.ts_to_string(log_time)}",  # 时间
@@ -108,8 +113,8 @@ def method_v001(client, userdata, message):
     LocalClass.last_log_key = log_key
     LocalClass.last_log_key = log_key
 
 
     # --- save ---
     # --- save ---
+    # methods.debug_log(f"MessageListenerV001|113", f"#log_list: {log_list}")
     log_file_path = os.path.join(save_dir, f'{log_uuid}.log')
     log_file_path = os.path.join(save_dir, f'{log_uuid}.log')
-    methods.debug_log(f"MessageListenerV001|113", f"#log_list: {log_list}")
     methods.write_text(log_file_path, ' | '.join(log_list) + '\n', 'a')
     methods.write_text(log_file_path, ' | '.join(log_list) + '\n', 'a')