From 71c9653d54634c4a44e1cc301b8ab5f0c9520aec Mon Sep 17 00:00:00 2001 From: huangzhenpc Date: Wed, 26 Feb 2025 10:02:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=9C=A8API?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E4=B8=AD=E6=B7=BB=E5=8A=A0=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=AD=A3=E6=96=87=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/email_routes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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'])