update pay ui
This commit is contained in:
26
app.py
26
app.py
@@ -9142,6 +9142,13 @@ def api_get_events():
|
||||
|
||||
# ==================== 构建查询 ====================
|
||||
query = Event.query
|
||||
|
||||
# 只返回有关联股票的事件(没有关联股票的事件不计入列表)
|
||||
from sqlalchemy import exists
|
||||
query = query.filter(
|
||||
exists().where(RelatedStock.event_id == Event.id)
|
||||
)
|
||||
|
||||
if event_status != 'all':
|
||||
query = query.filter_by(status=event_status)
|
||||
if event_type != 'all':
|
||||
@@ -10284,17 +10291,28 @@ def poll_new_events():
|
||||
if new_events:
|
||||
print(f'[轮询] 发现 {len(new_events)} 个新事件')
|
||||
|
||||
pushed_count = 0
|
||||
for event in new_events:
|
||||
# 检查事件是否有关联股票(只推送有关联股票的事件)
|
||||
related_stocks_count = event.related_stocks.count()
|
||||
|
||||
print(f'[轮询 DEBUG] 新事件详情:')
|
||||
print(f'[轮询 DEBUG] - ID: {event.id}')
|
||||
print(f'[轮询 DEBUG] - 标题: {event.title}')
|
||||
print(f'[轮询 DEBUG] - 事件发生时间(created_at): {event.created_at}')
|
||||
print(f'[轮询 DEBUG] - 事件类型: {event.event_type}')
|
||||
print(f'[轮询 DEBUG] - 关联股票数量: {related_stocks_count}')
|
||||
|
||||
# 推送新事件
|
||||
print(f'[轮询 DEBUG] 准备推送事件 ID={event.id}')
|
||||
broadcast_new_event(event)
|
||||
print(f'[轮询] ✓ 已推送事件 ID={event.id}, 标题={event.title}')
|
||||
# 只推送有关联股票的事件
|
||||
if related_stocks_count > 0:
|
||||
print(f'[轮询 DEBUG] 准备推送事件 ID={event.id}(有 {related_stocks_count} 个关联股票)')
|
||||
broadcast_new_event(event)
|
||||
pushed_count += 1
|
||||
print(f'[轮询] ✓ 已推送事件 ID={event.id}, 标题={event.title}')
|
||||
else:
|
||||
print(f'[轮询 DEBUG] 跳过事件 ID={event.id}(暂无关联股票)')
|
||||
|
||||
print(f'[轮询] 本轮共推送 {pushed_count}/{len(new_events)} 个事件')
|
||||
|
||||
# 更新已知事件ID集合(所有近24小时内的事件ID)
|
||||
known_event_ids_in_24h = set(event.id for event in events_in_24h)
|
||||
|
||||
Reference in New Issue
Block a user