update pay promo

This commit is contained in:
2026-02-03 19:12:09 +08:00
parent cf251d08e9
commit afaa1392e8
2 changed files with 41 additions and 32 deletions

View File

@@ -3444,11 +3444,11 @@ def get_calendar_event_counts():
# 修改查询以仅统计type为event的事件数量
query = """
SELECT DATE(calendar_time) as date, COUNT(*) as count
SELECT DATE(calendar_begin_time) as date, COUNT(*) as count
FROM future_events
WHERE calendar_time BETWEEN :start_date AND :end_date
WHERE calendar_begin_time BETWEEN :start_date AND :end_date
AND type = 'event'
GROUP BY DATE(calendar_time)
GROUP BY DATE(calendar_begin_time)
"""
result = db.session.execute(text(query), {
@@ -5965,7 +5965,8 @@ def api_calendar_events():
# 添加新字段 second_modified_text, `second_modified_text.1`, best_matches 支持新旧回退
query = """
SELECT data_id, \
calendar_time, \
calendar_begin_time, \
calendar_end_time, \
type, \
star, \
title, \
@@ -5983,10 +5984,10 @@ def api_calendar_events():
params = {}
if start_date:
query += " AND calendar_time >= :start_date"
query += " AND calendar_begin_time >= :start_date"
params['start_date'] = datetime.fromisoformat(start_date)
if end_date:
query += " AND calendar_time <= :end_date"
query += " AND calendar_begin_time <= :end_date"
params['end_date'] = datetime.fromisoformat(end_date)
# 重要性筛选(支持多选,逗号分隔,如 importance=S,A,B
if importance != 'all':
@@ -6010,7 +6011,7 @@ def api_calendar_events():
)"""
params['search_pattern'] = f'%{search_query}%'
query += " ORDER BY calendar_time LIMIT :limit OFFSET :offset"
query += " ORDER BY calendar_begin_time LIMIT :limit OFFSET :offset"
params['limit'] = per_page
params['offset'] = offset
@@ -6028,9 +6029,9 @@ def api_calendar_events():
count_params.pop('offset', None)
if start_date:
count_query += " AND calendar_time >= :start_date"
count_query += " AND calendar_begin_time >= :start_date"
if end_date:
count_query += " AND calendar_time <= :end_date"
count_query += " AND calendar_begin_time <= :end_date"
# 重要性筛选(支持多选,逗号分隔)
if importance != 'all':
importance_list = [i.strip().upper() for i in importance.split(',') if i.strip()]
@@ -6195,8 +6196,8 @@ def api_calendar_events():
'id': event.data_id,
'title': event.title,
'description': f"前值: {cleaned_former}, 预测: {cleaned_forecast}" if cleaned_former or cleaned_forecast else "",
'start_time': event.calendar_time.isoformat() if event.calendar_time else None,
'end_time': None, # future_events 表没有结束时间
'start_time': event.calendar_begin_time.isoformat() if event.calendar_begin_time else None,
'end_time': event.calendar_end_time.isoformat() if event.calendar_end_time else None,
'category': {
'event_type': event.type,
'importance': event.star,
@@ -6276,7 +6277,7 @@ def api_calendar_data():
former, \
forecast, \
star, \
calendar_time as created_at
calendar_begin_time as created_at
FROM future_events
WHERE type = 'data' \
"""
@@ -6284,16 +6285,16 @@ def api_calendar_data():
# 添加时间筛选条件
params = {}
if start_date:
query2_sql += " AND calendar_time >= :start_date"
query2_sql += " AND calendar_begin_time >= :start_date"
params['start_date'] = start_date
if end_date:
query2_sql += " AND calendar_time <= :end_date"
query2_sql += " AND calendar_begin_time <= :end_date"
params['end_date'] = end_date
if data_type != 'all':
query2_sql += " AND type = :data_type"
params['data_type'] = data_type
query2_sql += " ORDER BY calendar_time DESC"
query2_sql += " ORDER BY calendar_begin_time DESC"
result2 = db.session.execute(text(query2_sql), params)
@@ -6433,7 +6434,8 @@ def api_future_event_detail(item_id):
# 添加新字段 second_modified_text, `second_modified_text.1`, best_matches 支持新旧回退
query = """
SELECT data_id, \
calendar_time, \
calendar_begin_time, \
calendar_end_time, \
type, \
star, \
title, \
@@ -6649,7 +6651,9 @@ def api_future_event_detail(item_id):
'title': event.title,
'type': event.type,
'star': event.star,
'calendar_time': event.calendar_time.isoformat() if event.calendar_time else None,
'calendar_time': event.calendar_begin_time.isoformat() if event.calendar_begin_time else None, # 兼容旧字段名
'calendar_begin_time': event.calendar_begin_time.isoformat() if event.calendar_begin_time else None,
'calendar_end_time': event.calendar_end_time.isoformat() if event.calendar_end_time else None,
'former': former_value, # 使用回退后的值(优先 second_modified_text
'forecast': forecast_value, # 使用回退后的值(优先 second_modified_text.1
'concepts': event.concepts,