修复:在API响应中添加完整邮件正文内容

This commit is contained in:
huangzhenpc
2025-02-26 10:02:44 +08:00
parent c274583872
commit 71c9653d54

View File

@@ -64,7 +64,7 @@ def get_email(email_id):
email = db.query(Email).filter_by(id=email_id).first()
if not email:
return jsonify({'error': '邮件不存在'}), 404
return jsonify({'error': '邮件不存在', 'success': False}), 404
# 标记为已读
if mark_as_read and not email.read:
@@ -87,12 +87,12 @@ def get_email(email_id):
})
result['attachments'] = attachments
return jsonify(result), 200
return jsonify({'email': result, 'success': True}), 200
finally:
db.close()
except Exception as e:
current_app.logger.error(f"获取邮件详情出错: {str(e)}")
return jsonify({'error': '获取邮件详情失败', 'details': str(e)}), 500
return jsonify({'error': '获取邮件详情失败', 'details': str(e), 'success': False}), 500
# 删除邮件
@api_bp.route('/emails/<int:email_id>', methods=['DELETE'])