feat(core): 添加大化县政府网采购公告数据表和相关功能

- 创建 dahuagov_announcements 表用于存储大化县政府网采购公告
- 添加相关索引以提高查询性能
- 实现 save_dahuagov_announcements、get_new_dahuagov_announcements
  和 mark_dahuagov_announcements_sent 方法
- 修改统计查询以包含大化县公告数据
- 更新内容哈希检查逻辑以支持新表

feat(cron): 集成大化县政府网采购公告爬取功能

- 导入大化县政府网爬虫模块
- 修改定时任务流程以同时爬取广西政府采购网和大化县政府网
- 对不同来源公告采用不同处理策略:
  - 广西政府采购网:关键词筛选后推送
  - 大化县政府网:全部推送,不过滤关键词
- 分别处理和统计两个来源的公告数据
- 实现独立的通知发送和状态更新机制

feat(notification): 优化企业微信通知显示大化县来源标识

- 为不同来源公告添加前缀标识(【大化县政府网】或【广西政府采购网】)
- 根据公告来源动态调整通知标题:
  - 单一来源显示具体来源
  - 双来源显示"双源监控"标识
- 改进通知卡片的来源区分度,便于用户识别公告来源
```
This commit is contained in:
2026-05-09 10:55:00 +08:00
parent bd8df98e9a
commit c548a8b5bd
17 changed files with 128615 additions and 22108 deletions
+32 -4
View File
@@ -383,14 +383,21 @@ class WeChatService:
if len(source_name) > 25: # 限制来源名称长度
source_name = source_name[:22] + "..."
# 根据来源代码添加前缀标识
source_prefix = ""
if announcement.source_code == 'dahuagov':
source_prefix = "【大化县政府网】"
else:
source_prefix = "【广西政府采购网】"
# 时间格式化
if announcement.publish_date:
time_str = announcement.publish_date.strftime("%Y-%m-%d %H:%M")
else:
time_str = "时间未知"
# 生成描述:类型 | 来源 | 时间(使用默认颜色)
description = f'<div style="font-size: 14px; margin-top: 8px;">{announcement_type_display} | {source_name} | {time_str}</div>'
# 生成描述:来源标识 | 类型 | 来源单位 | 时间
description = f'<div style="font-size: 14px; margin-top: 8px;">{source_prefix}{announcement_type_display} | {source_name} | {time_str}</div>'
# URL:公告详情链接
url = announcement.content_url
@@ -434,7 +441,18 @@ class WeChatService:
# 标题和概要
total_count = len(announcements)
lines.append("# 🔔 广西政府采购网公告更新")
# 检查是否包含多个来源
has_gxgp = any(a.source_code != 'dahuagov' for a in announcements)
has_dahua = any(a.source_code == 'dahuagov' for a in announcements)
if has_gxgp and has_dahua:
lines.append("# 🔔 政府采购公告更新(双源监控)")
elif has_dahua:
lines.append("# 🔔 大化县政府网采购公告更新")
else:
lines.append("# 🔔 广西政府采购网公告更新")
lines.append("")
lines.append(f"📊 **共发现 {total_count} 条新公告**")
lines.append("")
@@ -541,7 +559,17 @@ class WeChatService:
# 生成标题
total_count = len(announcements)
title = f"🔔 广西政府采购网公告更新 ({total_count}条)"
# 检查是否包含多个来源
has_gxgp = any(a.source_code != 'dahuagov' for a in announcements)
has_dahua = any(a.source_code == 'dahuagov' for a in announcements)
if has_gxgp and has_dahua:
title = f"🔔 政府采购公告更新 ({total_count}条) - 双源监控"
elif has_dahua:
title = f"🔔 大化县政府网采购公告更新 ({total_count}条)"
else:
title = f"🔔 广西政府采购网公告更新 ({total_count}条)"
# 生成描述HTML
html_parts = []