Commit Graph

56 Commits

Author SHA1 Message Date
v6ole c01a3d427b fix: 存库前先标记 keyword_matched,修复历史数据全为 false 的问题
pipeline 原来先存库再过滤,导致 keyword_matched 永远是 False。
改为先标记再存库,最新公告查询才能正确区分两个来源。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 17:51:00 +08:00
v6ole dc3ca1f76c feat: 最新公告点击时触发爬取并优化查询逻辑
- 点击时先爬取一次(60秒防重入),爬取期间发送提示
- 查询改为:广西政采网关键词匹配 + 大化县政府网全部,按时间倒序取6条

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 17:38:58 +08:00
v6ole 6d1d512fca feat: 最新公告改为全来源最新6条按时间排序
去掉关键词过滤限制,两个来源的公告统一按 publish_date 倒序取6条。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 17:21:48 +08:00
v6ole b2d0503bc2 fix: 大化县政府网公告抓取详情页获取精确发布时间
列表页只有日期(00:00),改为并发抓取详情页解析 <meta name="PubDate">
获取精确时分秒,失败时保留列表页日期作为 fallback。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 17:16:33 +08:00
v6ole 77c6722a92 fix: 修复广西政采网公告时间时区错误
fromtimestamp() 在 UTC 服务器上会少 8 小时,改为明确指定 Asia/Shanghai 时区解析。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 10:21:26 +08:00
v6ole 048fca283d fix: 最新公告恢复关键词过滤 2026-05-10 14:29:33 +08:00
v6ole 0121017272 fix: 最新公告直接返回最新5条 + 显示来源网站 + 菜单调整
- latest_announcements 不再过滤 keyword_matched,返回全部最新5条
- 每条公告显示来源网站(广西政府采购网/大化县政府网采购公告)
- 菜单「今日公告」改为顶级按钮「最新公告」,移除子菜单重复项
2026-05-10 14:29:02 +08:00
v6ole 24d844bf44 fix: /crawl/sources 包含独立爬虫来源 + trigger 支持 spider_name
- sources 接口原来只返回 GXGP 子来源,遗漏了大化县政府网
- trigger 接口现在支持 spider_name 参数指定单个爬虫
2026-05-10 14:22:58 +08:00
v6ole 9f90e16661 feat(wechat): 新增企微菜单功能并修复重复触发问题
- 新增「查询」菜单组:监控配置、系统状态、今日工作日、最新公告
- 新增「系统管理」子菜单:暂停/恢复定时任务处理器
- 修复立即爬取被企微重试机制触发多次的问题(60秒防重入锁)
- docker-compose 补充 image 名称和 container_name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 14:01:11 +08:00
v6ole d84c838e76 chore: 删除 dead code — markdown 文件生成功能
onu.md 和 markdown_generated 从未被实际使用,是旧项目遗留代码
2026-05-10 13:59:34 +08:00
v6ole e1c9a985ca chore: 添加 vendor/build 和 *.egg-info 到 gitignore 2026-05-09 19:15:16 +08:00
v6ole 2996920277 feat: 接入 LogHive 远程日志系统
- 添加 LogHiveHandler,启动时自动挂载到 root logger
- 所有 logging 日志自动异步发送到 LogHive,不影响主业务
- vendored loghive-client 包,Docker 构建时自动安装
- API Key 缺失时自动跳过,不影响本地开发
2026-05-09 19:14:56 +08:00
v6ole 1f18d2ec87 feat: 添加中国节假日感知定时功能
- 新增 chinese_holidays 表,通过 timor.tech API 同步节假日数据
- 修正 holiday 字段解读:holiday=true → 休息日,holiday=false → 调休工作日
- 工作日 8:00-22:00 每小时爬取,周末/节假日/夜间自动跳过
- 新增 /api/v1/holidays/sync 和 /api/v1/holidays/today 接口
- 企微菜单新增「同步节假日」按钮,支持手动触发同步
2026-05-09 18:27:27 +08:00
v6ole c3e06c997f fix: 移除 textcard 通知中的 HTML 标签,企业微信客户端不支持 2026-05-09 17:54:42 +08:00
v6ole 248866d73f chore: 修改宿主机端口映射 8000 → 18001 2026-05-09 17:47:43 +08:00
v6ole cbeb3c3504 fix: 连接 Pipeline 到爬取流程 + 夜间跳过 + 断网恢复
- CrawlService.run_spider 现在自动调用 PostCrawlPipeline(爬取→存储→筛选→去重→推送)
- 定时任务添加 22:00-06:00 夜间跳过逻辑
- 断网恢复后不会漏公告:爬虫每次从 API 按日期倒序抓取,未推送的公告下次自动补推
- Pipeline 的 _exclude_sent + mark_sent 防止重复推送
2026-05-09 16:10:30 +08:00
v6ole d851dafea9 fix: 防止重复推送通知 — 添加已发送检查 + GXGP 标记已发送
- Pipeline 新增 _exclude_sent() 方法,通知前查询数据库跳过 is_sent=True 的公告
- GXGP Spider mark_sent 改为 True,配合去重逻辑防止每次爬取重复通知
2026-05-09 16:00:04 +08:00
v6ole 6fbdf097b3 fix: 定时任务 cron 表达式改为从配置读取,消除硬编码 2026-05-09 15:55:56 +08:00
v6ole 241465ea7d chore: 删除无用文件(旧 cron 脚本、uWSGI 配置、过时 README 等) 2026-05-09 15:52:24 +08:00
v6ole d114d5dd6a chore: 添加 .claude/ 到 .gitignore 2026-05-09 15:45:29 +08:00
v6ole b3953bb71c fix: 修复公告列表 start_date/end_date 参数未转换为 date 对象导致 500 错误 2026-05-09 15:41:09 +08:00
v6ole 2efd3ce1a6 chore: 删除旧 Flask 项目文件,迁移到 FastAPI 架构
- 删除 gx_gp_monitor/ 旧项目目录(Flask CLI 架构)
- 删除 app.py(旧 WSGI 入口)
- 更新 alembic/env.py 为异步引擎(create_async_engine + run_sync)
2026-05-09 15:38:02 +08:00
v6ole 5cd2c5951b fix: 修复迁移中 is_sent 列缺少 server_default 导致 NOT NULL 约束失败
添加 server_default=sa.false() 确保已有数据行能正确设置默认值。
同时迁移旧表数据到 announcements 表后再删除旧表,避免数据丢失。
2026-05-09 15:36:42 +08:00
v6ole 808f3101e3 fix: 修复公告 API 路由顺序 — /today 和 /stats 在 /{id} 之前匹配
将具体路由移到参数化路由之前,避免 "today"/"stats" 被 {announcement_id} 作为整数解析而返回 422。
2026-05-09 15:19:49 +08:00
v6ole acff263dba chore: 从 git 跟踪中移除日志文件、onu.md 和 __pycache__
- 移除 logs/ 目录下的日志文件
- 移除 onu.md 生成文件
- 移除所有 __pycache__/ 目录
- 更新 .gitignore 防止再次提交
2026-05-09 15:03:40 +08:00
v6ole 04b78497b9 chore: 从 git 跟踪中移除含敏感信息的 config.yaml
将 config.yaml 添加到 .gitignore,并从 git 跟踪中移除。
配置现已通过 .env 环境变量管理,密码/token/AES key 不再提交到仓库。
2026-05-09 15:02:52 +08:00
v6ole 7455d7e426 chore: ruff 代码检查与修复
130 issues auto-fixed (import ordering, UP045/UP006 type annotations),
33 issues manually fixed (E712/E501/E402/E722 + N818 rename + per-file
wechat ignore for N8xx naming conventions). All 33 tests pass.
2026-05-09 14:28:09 +08:00
v6ole 02ea794015 feat: 添加 Docker 部署配置
通过 Dockerfile 和 docker-compose.yml 提供容器化部署方案。
2026-05-09 14:20:59 +08:00
v6ole a0a06dfd8c feat: 添加 API 路由(公告/爬取/微信回调/调度器)+ 健康检查测试 2026-05-09 14:19:11 +08:00
v6ole 3616e5799d feat: 添加 NotificationService 通知服务 + 测试 2026-05-09 14:11:49 +08:00
v6ole 52bb1f53cc feat: 迁移企业微信模块(crypto + client + handler) 2026-05-09 14:09:52 +08:00
v6ole 76b734b0a9 fix: 修复 filter_by_date 类型处理 + _save_to_db rowcount 0 值 bug 2026-05-09 14:06:59 +08:00
v6ole cad1390534 feat: 添加 PostCrawlPipeline 统一管道 + 筛选服务 + 测试 2026-05-09 13:57:37 +08:00
v6ole 022d348052 feat: 添加 CrawlService 爬取编排器 + 测试 2026-05-09 13:50:58 +08:00
v6ole 5e0582d499 feat: 添加 Dahuagov Spider(大化县政府网爬虫)+ 测试 2026-05-09 13:47:48 +08:00
v6ole b1bbf64287 feat: 添加 GXGP Spider(广西政府采购网爬虫)+ 测试 2026-05-09 13:44:45 +08:00
v6ole 7db14ee411 feat: 添加数据解析器模块 + 测试 2026-05-09 13:41:35 +08:00
v6ole d9af819d2e feat: 添加 Spider 基类 + Pipeline 配置 + 测试 2026-05-09 13:37:40 +08:00
v6ole a994dc5f53 feat: 添加 SQLAlchemy 模型 + Alembic 数据库迁移 2026-05-09 13:35:08 +08:00
v6ole 1cdd0bcab1 feat: 创建 FastAPI 项目骨架(config + main + 依赖管理) 2026-05-09 13:30:03 +08:00
v6ole 2324725c6f docs: 添加 FastAPI + Docker 迁移实施计划(15 个任务,TDD) 2026-05-09 13:06:32 +08:00
v6ole 8800d4b2b1 docs: 添加爬虫模块化设计(Spider 基类 + Pipeline 策略模式) 2026-05-09 12:52:48 +08:00
v6ole 79ef7c66af docs: 添加 FastAPI + Docker 迁移设计文档 2026-05-09 12:18:07 +08:00
v6ole c548a8b5bd ```
feat(core): 添加大化县政府网采购公告数据表和相关功能

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

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

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

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

- 为不同来源公告添加前缀标识(【大化县政府网】或【广西政府采购网】)
- 根据公告来源动态调整通知标题:
  - 单一来源显示具体来源
  - 双来源显示"双源监控"标识
- 改进通知卡片的来源区分度,便于用户识别公告来源
```
2026-05-09 10:55:00 +08:00
v6ole bd8df98e9a Remove obsolete scripts related to WeChat menu creation, server functionality, and cron job scheduling. Update project structure by deleting unnecessary files to streamline the codebase. 2026-01-28 16:54:40 +08:00
v6ole b37e8ce581 删除无用文件 2026-01-09 15:17:42 +08:00
v6ole f00068f804 修改通知模板 2026-01-09 11:07:10 +08:00
v6ole 72dc40186d Refactor the cron job functionality to transition from a crawling to a searching model. Update related documentation and scripts to reflect the new terminology and functionality, including changes in the README and script comments. Enhance WeChat menu and message handling to support the new search features, ensuring clarity in user interactions and logging. 2026-01-09 08:19:09 +08:00
v6ole 4000438f49 Remove deprecated files and scripts related to cron jobs and WeChat server functionality. Update README to include new server startup methods using uWSGI and Gunicorn. Ensure callback server configuration is loaded properly in production environments. Clean up unnecessary test scripts and example files to streamline the project structure. 2026-01-08 21:59:39 +08:00
v6ole 85cd7e9d3e Enhance manual crawling functionality in GXGPMonitorApp to skip database saving for both announcements and filtered results. Update logging to reflect manual crawl mode actions, ensuring clarity in the process. Adjusted comments for better understanding of the manual crawling logic. 2026-01-08 19:12:37 +08:00