This commit is contained in:
hailin 2024-10-28 15:15:14 +08:00
parent c5fad0da54
commit aa808affa7
2 changed files with 9 additions and 2 deletions

9
app.py
View File

@ -110,6 +110,7 @@ def view_customer(index):
# 添加统计逻辑 # 添加统计逻辑
total_emails = 0 total_emails = 0
cold_lead_count = 0 cold_lead_count = 0
no_promotion_count = 0
# 遍历所有客户数据 # 遍历所有客户数据
for customer in customer_data: for customer in customer_data:
@ -120,6 +121,10 @@ def view_customer(index):
# 检查邮件是否属于 "cold lead" # 检查邮件是否属于 "cold lead"
if email.get('category', '').lower() == "cold lead": if email.get('category', '').lower() == "cold lead":
cold_lead_count += 1 cold_lead_count += 1
# 检查是否没有推广历史
promotion_history = email.get('promotion history', [])
if not promotion_history:
no_promotion_count += 1
is_first = index == 0 is_first = index == 0
is_last = index == len(customer_data) - 1 is_last = index == len(customer_data) - 1
@ -131,7 +136,9 @@ def view_customer(index):
is_first=is_first, is_first=is_first,
is_last=is_last, is_last=is_last,
total_emails=total_emails, total_emails=total_emails,
cold_lead_count=cold_lead_count) cold_lead_count=cold_lead_count,
no_promotion_count=no_promotion_count)
# @app.route('/customer/<int:index>') # @app.route('/customer/<int:index>')
# def view_customer(index): # def view_customer(index):

View File

@ -82,7 +82,7 @@
<!-- 固定状态栏 --> <!-- 固定状态栏 -->
<div class="status-bar"> <div class="status-bar">
<p>Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }}</p> <p>Total Emails: {{ total_emails }} | Cold Leads: {{ cold_lead_count }} | No Promotion: {{ no_promotion_count }}</p>
</div> </div>
<!-- JavaScript 脚本 --> <!-- JavaScript 脚本 -->