|
@@ -1,6 +1,7 @@
|
|
from hub import methods, Global
|
|
from hub import methods, Global
|
|
|
|
|
|
import threading
|
|
import threading
|
|
|
|
+import traceback
|
|
import time
|
|
import time
|
|
import json
|
|
import json
|
|
import os
|
|
import os
|
|
@@ -73,20 +74,26 @@ def method_c001(client, userdata, message):
|
|
"""
|
|
"""
|
|
# --- print ---
|
|
# --- print ---
|
|
# methods.debug_log(f"method_c001|75", f"#message.payload: {message.payload}")
|
|
# methods.debug_log(f"method_c001|75", f"#message.payload: {message.payload}")
|
|
- # log_dict = json.loads(message.payload)
|
|
|
|
- # try:
|
|
|
|
- # log_dict = json.loads(message.payload)
|
|
|
|
- # methods.debug_log(f"MessageListenerC001|19", f"#message.payload: {repr(log_dict)}")
|
|
|
|
- # except Exception as e:
|
|
|
|
- # pass
|
|
|
|
|
|
+ try:
|
|
|
|
+ log_dict = json.loads(message.payload)
|
|
|
|
+ except Exception as exception:
|
|
|
|
+ methods.debug_log("method_c001|79", f"#message.payload: {message.payload}")
|
|
|
|
+ methods.debug_log("method_c001|79", f"#exception: {exception.__class__.__name__}")
|
|
|
|
+ methods.debug_log("method_c001|79", f"#traceback: {traceback.format_exc()}")
|
|
|
|
+ return
|
|
|
|
|
|
- # --- fill log_list ---
|
|
|
|
- log_dict = json.loads(message.payload)
|
|
|
|
|
|
+ # --- check ---
|
|
|
|
+ # log_dict = json.loads(message.payload)
|
|
log_time = int(log_dict.get('timeStamp')) / 1000
|
|
log_time = int(log_dict.get('timeStamp')) / 1000
|
|
user_uuid = log_dict.get('userID')
|
|
user_uuid = log_dict.get('userID')
|
|
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:
|
|
|
|
+ return
|
|
|
|
+
|
|
|
|
+ # --- fill log_list ---
|
|
log_list = [
|
|
log_list = [
|
|
|
|
|
|
f"timeStamp: {methods.ts_to_string(log_time)}", # 时间
|
|
f"timeStamp: {methods.ts_to_string(log_time)}", # 时间
|