From 8855475bbb1e0c24b76dbd82bc858b07ba07c4f8 Mon Sep 17 00:00:00 2001 From: huangzhenpc Date: Wed, 5 Mar 2025 11:11:41 +0800 Subject: [PATCH] xf --- app/__init__.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index bdd5063..857c417 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -54,14 +54,23 @@ def create_app(): @app.route('/web/list') def list_emails_page(): - emails = get_latest_emails(count=50) - return render_template('email_list.html', emails=emails) + try: + # 不指定 recipient,获取所有邮件 + emails = get_latest_emails(recipient=None, count=50) + return render_template('email_list.html', emails=emails) + except Exception as e: + app.logger.error(f"Error in list_emails_page: {str(e)}") + return "获取邮件列表失败", 500 - @app.route('/email/') + @app.route('/web/email/') def view_email_page(recipient): - email = get_latest_email_with_code(recipient) - if email: - return render_template('email_detail.html', email=email) - return "邮件不存在", 404 + try: + email = get_latest_email_with_code(recipient) + if email: + return render_template('email_detail.html', email=email) + return "邮件不存在", 404 + except Exception as e: + app.logger.error(f"Error in view_email_page: {str(e)}") + return "获取邮件详情失败", 500 return app \ No newline at end of file