|
@@ -1148,26 +1148,31 @@ def uid_status(request):
|
|
|
'msgData': qs[0]['msg_notify']
|
|
|
}
|
|
|
|
|
|
- # 检查 channel 有效性和 msg_notify 是否存在
|
|
|
- if channel > 0 and is_nvr == 1 and qs[0].get('msg_notify'):
|
|
|
- # 获取 msg_notify 数据
|
|
|
- msg_notify = qs[0]['msg_notify']
|
|
|
- nvr_entries = msg_notify.get('nvr', [])
|
|
|
- channel_key = f'channel{channel}'
|
|
|
-
|
|
|
- # 查找匹配的 channel_entry
|
|
|
- matching_entry = next((entry for entry in nvr_entries if channel_key in entry), None)
|
|
|
-
|
|
|
- if matching_entry:
|
|
|
- # 更新 nvr 值
|
|
|
- data['msgData']['nvr'] = matching_entry[channel_key]
|
|
|
+ try:
|
|
|
+ # 检查 channel 有效性和 msg_notify 是否存在
|
|
|
+ if channel > 0 and is_nvr == 1 and qs[0].get('msg_notify'):
|
|
|
+ # 获取 msg_notify 数据
|
|
|
+ msg_notify = qs[0]['msg_notify']
|
|
|
+ nvr_entries = msg_notify.get('nvr', [])
|
|
|
+ channel_key = f'channel{channel}'
|
|
|
+
|
|
|
+ # 查找匹配的 channel_entry
|
|
|
+ matching_entry = next((entry for entry in nvr_entries if channel_key in entry), None)
|
|
|
+
|
|
|
+ if matching_entry:
|
|
|
+ # 更新 nvr 值
|
|
|
+ data['msgData']['nvr'] = matching_entry[channel_key]
|
|
|
+ else:
|
|
|
+ # 没有找到匹配的 channel,使用默认值替换 nvr
|
|
|
+ available_types = [t for t in ALGORITHM_COMBO_TYPES if t != 51]
|
|
|
+ data['msgData']['nvr'] = available_types
|
|
|
else:
|
|
|
- # 没有找到匹配的 channel,使用默认值替换 nvr
|
|
|
- available_types = [t for t in ALGORITHM_COMBO_TYPES if t != 51]
|
|
|
- data['msgData']['nvr'] = available_types
|
|
|
- else:
|
|
|
- if 'nvr' in qs[0].get('msg_notify'):
|
|
|
- data['msgData']['nvr'] = []
|
|
|
+ msg_notify = qs[0].get('msg_notify')
|
|
|
+ if msg_notify and 'nvr' in msg_notify:
|
|
|
+ data['msgData']['nvr'] = []
|
|
|
+ except Exception as e:
|
|
|
+ logger.error(f'查询消息提醒异常uid:{uid},error:{repr(e)}')
|
|
|
+
|
|
|
|
|
|
# 调试
|
|
|
debugTwos = int(time.time())
|