Commit Graph

45 Commits

Author SHA1 Message Date
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
v6ole 04d254cfef Implement manual crawling feature in GXGPMonitorApp, allowing users to filter announcements by date and keywords. Update Markdown generation to include time period and keyword details. Remove outdated onu.md file. Enhance WeChat message handling to support manual crawl results and improve logging for better traceability. 2026-01-08 18:24:00 +08:00
v6ole b52d9c069d Update announcement timestamp in onu.md and enhance logger formatting to preserve original message and levelname. Remove outdated onu.md file and log files, and add type hints in main.py for better code clarity. 2026-01-08 16:40:10 +08:00
v6ole 5f8ebd2da5 Refactor logger to implement a global file handler, preventing duplicate log entries. Updated logger initialization to ensure a single file handler is used across all loggers, enhancing logging efficiency and clarity. 2026-01-08 16:18:41 +08:00
v6ole a8108d9afd Remove legacy test script and enhance main application with WeChat server and menu management features. Added commands for starting the WeChat callback server and managing WeChat menus, along with necessary imports and error handling. Updated requirements to include Flask for the WeChat server functionality. 2026-01-08 15:16:42 +08:00
v6ole 317dbf3c58 Enhance announcement storage functionality by adding a method to save all announcements by source, retaining the latest 100 per source. Update related logging and comments for clarity. Adjusted the main script to utilize the new storage method and log the saving process. Updated the markdown file timestamp. 2026-01-08 09:31:47 +08:00
v6ole 28c57a040a 手动模式 2026-01-07 17:37:09 +08:00