fix: 修复报表日期显示问题,使用开始时间提取日期

Coze-Commit-Type: user
Coze-User-ID: 3722323274763196
Coze-Conversation-ID: 9894087
This commit is contained in:
user9994793890
2026-07-13 13:42:49 +08:00
parent c104b56add
commit 23f1ea050e
2 changed files with 3 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -558,10 +558,10 @@ def generate_excel(orders, selected_fields, sum_fields, sum_results,
os.makedirs(reports_dir, exist_ok=True) os.makedirs(reports_dir, exist_ok=True)
# 生成文件名 - 格式配置名称_几月几日消费记录.xlsx # 生成文件名 - 格式配置名称_几月几日消费记录.xlsx
# 从 end_time 提取日期(格式2026-07-13 08:00:00 # 从 start_time 提取日期(报表数据对应的是开始时间那天的数据
try: try:
end_dt = datetime.strptime(end_time, '%Y-%m-%d %H:%M:%S') start_dt = datetime.strptime(start_time, '%Y-%m-%d %H:%M:%S')
date_str = f'{end_dt.month}{end_dt.day}' date_str = f'{start_dt.month}{start_dt.day}'
except: except:
date_str = datetime.now().strftime('%m月%d') date_str = datetime.now().strftime('%m月%d')