Merge branch 'dev-v15' of http://121.37.111.42:3000/ThbTech/BodyBalanceEvaluation into dev-v15
This commit is contained in:
commit
513e9867a6
@ -1319,6 +1319,45 @@ class AppServer:
|
||||
self.logger.error(f'检查会话检测数据存在失败: {e}')
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
@self.app.route('/api/detection/<session_id>/get_data', methods=['GET'])
|
||||
def get_session_detection_data(session_id: str):
|
||||
try:
|
||||
if not self.db_manager:
|
||||
return jsonify({'success': False, 'error': '数据库管理器未初始化'}), 500
|
||||
|
||||
# 获取检测数据和视频数据
|
||||
session_data = self.db_manager.get_session_data(session_id)
|
||||
if not session_data:
|
||||
return jsonify({'success': False, 'error': '会话不存在'}), 404
|
||||
|
||||
result_data = []
|
||||
|
||||
# 处理检测数据
|
||||
if 'data' in session_data:
|
||||
for item in session_data['data']:
|
||||
item_copy = item.copy()
|
||||
item_copy['type'] = 'data'
|
||||
result_data.append(item_copy)
|
||||
|
||||
# 处理视频数据
|
||||
if 'videos' in session_data:
|
||||
for item in session_data['videos']:
|
||||
item_copy = item.copy()
|
||||
item_copy['type'] = 'video'
|
||||
result_data.append(item_copy)
|
||||
|
||||
# 按时间戳排序
|
||||
result_data.sort(key=lambda x: x.get('timestamp', ''), reverse=False)
|
||||
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'session_id': session_id,
|
||||
'data': result_data
|
||||
})
|
||||
except Exception as e:
|
||||
self.logger.error(f'获取会话检测数据失败: {e}')
|
||||
return jsonify({'success': False, 'error': str(e)}), 500
|
||||
|
||||
@self.app.route('/api/detection/<session_id>/stop', methods=['POST'])
|
||||
def stop_detection(session_id):
|
||||
"""停止检测"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user