diff --git a/app/api/email_routes.py b/app/api/email_routes.py index 91682e1..848123b 100644 --- a/app/api/email_routes.py +++ b/app/api/email_routes.py @@ -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/', methods=['DELETE'])