修复:在API响应中添加完整邮件正文内容
This commit is contained in:
@@ -64,7 +64,7 @@ def get_email(email_id):
|
|||||||
email = db.query(Email).filter_by(id=email_id).first()
|
email = db.query(Email).filter_by(id=email_id).first()
|
||||||
|
|
||||||
if not email:
|
if not email:
|
||||||
return jsonify({'error': '邮件不存在'}), 404
|
return jsonify({'error': '邮件不存在', 'success': False}), 404
|
||||||
|
|
||||||
# 标记为已读
|
# 标记为已读
|
||||||
if mark_as_read and not email.read:
|
if mark_as_read and not email.read:
|
||||||
@@ -87,12 +87,12 @@ def get_email(email_id):
|
|||||||
})
|
})
|
||||||
result['attachments'] = attachments
|
result['attachments'] = attachments
|
||||||
|
|
||||||
return jsonify(result), 200
|
return jsonify({'email': result, 'success': True}), 200
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.error(f"获取邮件详情出错: {str(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'])
|
@api_bp.route('/emails/<int:email_id>', methods=['DELETE'])
|
||||||
|
|||||||
Reference in New Issue
Block a user