Просмотр исходного кода

fix: 修复批次上报字段和日志及接口路径问题

1. 修正batch_report接口路径添加末尾斜杠
2. 上报失败时新增响应内容日志打印
3. 修正total_persons和ptz_images_count取值逻辑
wenhongquan 2 дней назад
Родитель
Сommit
3752a50fd9

+ 1 - 1
dual_camera_system/config/device.py

@@ -48,7 +48,7 @@ THIRD_PARTY_CONFIG = {
     # 接口路径配置
     'endpoints': {
         # 批次信息上报接口(接收 batch_info.json)
-        'batch_report': '/api/v1/human-analysis',
+        'batch_report': '/api/v1/human-analysis/',
         
         # 心跳接口
         'heartbeat': '/api/device/heartbeat',

+ 2 - 2
dual_camera_system/paired_image_saver.py

@@ -935,8 +935,8 @@ class PairedImageSaver:
             'project_id': batch.project_id,
             'timestamp': batch.timestamp,
             'datetime': datetime.fromtimestamp(batch.timestamp).isoformat(),
-            'total_persons': batch.total_persons,
-            'ptz_images_count': batch.ptz_images_count,
+            'total_persons': len(persons_list),
+            'ptz_images_count': len(persons_list),
             'panorama': {
                 'local_path': batch.panorama_path,  # 标记图
                 'local_path_original': batch.panorama_original_path,  # 原图

+ 5 - 1
dual_camera_system/third_party_pusher.py

@@ -261,7 +261,11 @@ class ThirdPartyPusher:
                         logger.warning(f"[第三方平台] 批次上报失败: {result.get('msg', '未知错误')}")
                 else:
                     logger.warning(f"[第三方平台] 批次上报失败: HTTP {response.status_code}")
-                
+                    try:
+                        logger.warning(f"[第三方平台] 响应内容: {response.text[:500]}")
+                    except Exception:
+                        pass
+
                 if attempt < self.retry_count - 1:
                     time.sleep(self.retry_delay)