diff --git a/CRON_README.md b/CRON_README.md new file mode 100644 index 0000000..ff0c6aa --- /dev/null +++ b/CRON_README.md @@ -0,0 +1,161 @@ +# 定时爬取脚本使用说明 + +## 脚本功能 + +`cron_crawl.py` 是一个用于定时爬取广西政府采购网公告的脚本,具有以下功能: + +- ✅ 从 `gx_gp_monitor/config/config.yaml` 读取关键词配置 +- ✅ 爬取最新的公告(数据库中没有的) +- ✅ 自动筛选匹配关键词的公告 +- ✅ 将筛选结果保存到数据库 +- ✅ 以卡片形式发送企业微信通知 + +## 文件结构 + +``` +project/ +├── venv/ # Python虚拟环境 +├── gx_gp_monitor/ +│ ├── cron_crawl.py # 定时爬取主脚本 +│ └── config/config.yaml # 配置文件 +├── run_cron_crawl.sh # 启动脚本(自动激活虚拟环境) +├── CRON_README.md # 使用说明 +└── cron_example.txt # crontab配置示例 +``` + +## 使用方法 + +### 1. 使用启动脚本(推荐) + +```bash +# 在项目根目录下运行 +./run_cron_crawl.sh +``` + +### 2. 直接运行Python脚本 + +```bash +cd gx_gp_monitor +python cron_crawl.py +``` + +### 3. 使用crontab定时运行 + +在Ubuntu系统上设置定时任务: + +```bash +# 编辑crontab +crontab -e + +# 添加定时任务(例如:每小时执行一次) +0 * * * * cd /home/v6ole/pyproject/GX-gp-notify && ./run_cron_crawl.sh >> /home/v6ole/pyproject/GX-gp-notify/logs/cron.log 2>&1 + +# 或者每30分钟执行一次 +*/30 * * * * cd /home/v6ole/pyproject/GX-gp-notify && ./run_cron_crawl.sh >> /home/v6ole/pyproject/GX-gp-notify/logs/cron.log 2>&1 + +# 或者每天早上9点执行 +0 9 * * * cd /home/v6ole/pyproject/GX-gp-notify && ./run_cron_crawl.sh >> /home/v6ole/pyproject/GX-gp-notify/logs/cron.log 2>&1 +``` + +**注意**: 脚本会自动激活项目中的虚拟环境(`venv`目录),无需手动处理虚拟环境。 + +### 3. 脚本输出示例 + +``` +=== 定时爬取任务完成 === +总共爬取: 1300 条公告 +新增公告: 5 条 +关键词筛选: 2 条 +保存到数据库: 2 条 +企业微信通知: 成功 +``` + +## 配置说明 + +### 关键词配置 + +在 `gx_gp_monitor/config/config.yaml` 中配置关键词: + +```yaml +crawler: + keyword: ["大化", "信息化"] # 支持多个关键词 +``` + +### 企业微信配置 + +确保企业微信配置正确: + +```yaml +wechat_app: + enabled: true # 必须启用 + corp_id: "your_corp_id" + agent_id: "your_agent_id" + secret: "your_secret" +``` + +### 数据库配置 + +确保数据库配置正确: + +```yaml +database: + enabled: true # 必须启用 + host: "your_db_host" + port: 5432 + name: "your_db_name" + user: "your_db_user" + password: "your_db_password" +``` + +## 日志查看 + +脚本运行日志保存在 `logs/gx_gp_monitor.log`,crontab输出日志保存在您配置的文件中。 + +```bash +# 查看最新日志 +tail -f logs/gx_gp_monitor.log + +# 查看crontab日志 +tail -f /home/v6ole/pyproject/GX-gp-notify/logs/cron.log +``` + +## 注意事项 + +1. **权限设置**:确保脚本有执行权限 + ```bash + chmod +x cron_crawl.py + ``` + +2. **Python环境**:确保Python环境和依赖已正确安装 + ```bash + pip install -r gx_gp_monitor/requirements.txt + ``` + +3. **路径配置**:crontab中的路径必须是绝对路径 + +4. **时区设置**:确保系统时区设置正确,影响定时任务执行时间 + +5. **资源消耗**:爬取过程中会消耗一定的CPU和网络资源,建议在非高峰期运行 + +## 故障排除 + +### 脚本无法运行 +- 检查Python环境和依赖 +- 检查配置文件路径 +- 检查数据库连接 + +### 企业微信通知失败 +- 检查企业微信配置 +- 检查网络连接 +- 查看企业微信应用权限 + +### 数据库连接失败 +- 检查数据库配置 +- 检查数据库服务状态 +- 检查网络连接 + +### crontab不执行 +- 检查crontab语法 +- 检查脚本路径 +- 检查用户权限 +- 查看系统日志:`sudo grep CRON /var/log/syslog` diff --git a/cron_example.txt b/cron_example.txt new file mode 100644 index 0000000..ee5aecf --- /dev/null +++ b/cron_example.txt @@ -0,0 +1,17 @@ +# 定时爬取脚本 crontab 配置示例 +# 使用方法: crontab -e 然后复制粘贴以下内容 + +# 每小时执行一次(整点) +0 * * * * cd /home/v6ole/pyproject/GX-gp-notify && ./run_cron_crawl.sh >> /home/v6ole/pyproject/GX-gp-notify/logs/cron.log 2>&1 + +# 每30分钟执行一次 +*/30 * * * * cd /home/v6ole/pyproject/GX-gp-notify && ./run_cron_crawl.sh >> /home/v6ole/pyproject/GX-gp-notify/logs/cron.log 2>&1 + +# 每天早上9点执行 +0 9 * * * cd /home/v6ole/pyproject/GX-gp-notify && ./run_cron_crawl.sh >> /home/v6ole/pyproject/GX-gp-notify/logs/cron.log 2>&1 + +# 工作日(周一到周五)每小时执行一次 +0 * * * 1-5 cd /home/v6ole/pyproject/GX-gp-notify && ./run_cron_crawl.sh >> /home/v6ole/pyproject/GX-gp-notify/logs/cron.log 2>&1 + +# 周一到周五早上8:30和下午2:30执行 +30 8,14 * * 1-5 cd /home/v6ole/pyproject/GX-gp-notify && ./run_cron_crawl.sh >> /home/v6ole/pyproject/GX-gp-notify/logs/cron.log 2>&1 diff --git a/gx_gp_monitor/__pycache__/main.cpython-313.pyc b/gx_gp_monitor/__pycache__/main.cpython-313.pyc index a7945ae..60ca536 100644 Binary files a/gx_gp_monitor/__pycache__/main.cpython-313.pyc and b/gx_gp_monitor/__pycache__/main.cpython-313.pyc differ diff --git a/gx_gp_monitor/cron_crawl.py b/gx_gp_monitor/cron_crawl.py new file mode 100755 index 0000000..4f7b68b --- /dev/null +++ b/gx_gp_monitor/cron_crawl.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 +""" +定时爬取脚本 +执行爬取、筛选关键词、保存到数据库并发送企业微信卡片通知 +""" + +import sys +import os +from pathlib import Path + +# 添加项目根目录到路径(gx_gp_monitor的父目录) +project_root = Path(__file__).parent.parent +sys.path.insert(0, str(project_root)) + +try: + from gx_gp_monitor.core.config_manager import load_config, get_config + from gx_gp_monitor.core.logger import init_logger, get_logger + from gx_gp_monitor.crawler.spider import crawl_announcements + from gx_gp_monitor.filters.filters import filter_from_config + from gx_gp_monitor.storage.postgresql import init_storage, save_announcements_to_storage, save_all_announcements_by_source_to_storage + from gx_gp_monitor.notification.wechat import send_announcements_notification, send_system_notification + + logger = get_logger(__name__) + + def main(): + """主函数:执行定时爬取任务""" + try: + # 加载配置 + config = load_config() + if not config: + logger.error("无法加载配置") + return False + + # 初始化日志 + init_logger(config=config) + + logger.info("=== 开始定时爬取任务 ===") + + # 初始化存储 + init_storage() + + # 执行爬取 + logger.info("开始执行爬取...") + crawl_results = crawl_announcements() + + if not crawl_results: + logger.info("爬取完成:无数据") + return True + + # 收集所有公告 + all_announcements = [] + for result in crawl_results: + if result.announcements: + all_announcements.extend(result.announcements) + + total_crawled = len(all_announcements) + logger.info(f"爬取到 {total_crawled} 条原始公告") + + # 保存所有公告(按来源分组,每源保留最新100条) + all_saved_stats = save_all_announcements_by_source_to_storage(all_announcements, max_per_source=100) + all_saved_count = sum(all_saved_stats.values()) + logger.info(f"保存所有公告完成:共保存 {all_saved_count} 条,按来源统计: {all_saved_stats}") + + # 筛选出新公告(数据库中没有的) + new_announcements = [ann for ann in all_announcements if ann.is_new] + logger.info(f"筛选出 {len(new_announcements)} 条新公告") + + if not new_announcements: + logger.info("没有新的公告,任务完成") + return True + + # 对新公告应用关键词筛选 + filter_obj = filter_from_config() + filtered_announcements, filter_stats = filter_obj.filter(new_announcements) + + logger.info(f"关键词筛选后剩余 {len(filtered_announcements)} 条公告") + + if not filtered_announcements: + logger.info("没有匹配关键词的公告,任务完成") + return True + + # 保存筛选后的公告(用于标记关键词匹配等) + saved_count = save_announcements_to_storage(filtered_announcements) + logger.info(f"保存筛选后公告完成:{saved_count} 条") + + # 发送企业微信卡片通知 + if config.wechat_app.enabled: + logger.info("开始发送企业微信卡片通知...") + notify_success = send_announcements_notification(filtered_announcements) + + if notify_success: + logger.info("企业微信卡片通知发送成功") + else: + logger.error("企业微信卡片通知发送失败") + else: + logger.info("企业微信通知未启用,跳过发送") + + # 输出统计信息 + print("\n=== 定时爬取任务完成 ===") + print(f"总共爬取: {total_crawled} 条公告") + print(f"新增公告: {len(new_announcements)} 条") + print(f"关键词筛选: {len(filtered_announcements)} 条") + print(f"保存到数据库: {saved_count} 条") + print(f"企业微信通知: {'成功' if notify_success else '失败' if config.wechat_app.enabled else '未启用'}") + + logger.info("=== 定时爬取任务完成 ===") + return True + + except Exception as e: + logger.error(f"定时爬取任务执行失败: {str(e)}") + print(f"❌ 定时爬取任务失败: {str(e)}", file=sys.stderr) + + # 尝试发送错误通知 + try: + if config and config.wechat_app.enabled: + send_system_notification( + "定时爬取任务失败", + f"错误信息: {str(e)}" + ) + except Exception as notify_error: + logger.error(f"发送错误通知失败: {notify_error}") + + return False + + if __name__ == "__main__": + success = main() + sys.exit(0 if success else 1) + +except ImportError as e: + print(f"导入失败: {e}", file=sys.stderr) + print("请确保已安装所有依赖: pip install -r gx_gp_monitor/requirements.txt", file=sys.stderr) + sys.exit(1) +except Exception as e: + print(f"脚本执行失败: {e}", file=sys.stderr) + sys.exit(1) diff --git a/gx_gp_monitor/main.py b/gx_gp_monitor/main.py index a1ab608..f524761 100644 --- a/gx_gp_monitor/main.py +++ b/gx_gp_monitor/main.py @@ -116,10 +116,16 @@ class GXGPMonitorApp: logger.info(f"爬取到 {len(all_announcements)} 条原始公告") - # 先保存所有公告(按来源分组,每源保留最新100条) - all_saved_stats = save_all_announcements_by_source_to_storage(all_announcements, max_per_source=100) - all_saved_count = sum(all_saved_stats.values()) - logger.info(f"保存所有公告完成:共保存 {all_saved_count} 条,按来源统计: {all_saved_stats}") + # 对于手动爬取,不保存公告到数据库,只进行筛选和返回结果 + if not manual_crawl: + # 先保存所有公告(按来源分组,每源保留最新100条) + all_saved_stats = save_all_announcements_by_source_to_storage(all_announcements, max_per_source=100) + all_saved_count = sum(all_saved_stats.values()) + logger.info(f"保存所有公告完成:共保存 {all_saved_count} 条,按来源统计: {all_saved_stats}") + else: + all_saved_count = 0 + all_saved_stats = {} + logger.info("手动爬取模式:跳过数据库保存") # 筛选公告 if manual_crawl: @@ -169,8 +175,13 @@ class GXGPMonitorApp: logger.info(f"筛选后剩余 {len(filtered_announcements)} 条公告") - # 保存筛选后的公告(用于标记关键词匹配等) - saved_count = save_announcements_to_storage(filtered_announcements) + # 对于手动爬取,不保存筛选后的公告到数据库 + if not manual_crawl: + # 保存筛选后的公告(用于标记关键词匹配等) + saved_count = save_announcements_to_storage(filtered_announcements) + else: + saved_count = 0 + logger.info("手动爬取模式:跳过筛选后公告的数据库保存") # 生成Markdown文件(只在自动爬取时生成) md_success = False diff --git a/gx_gp_monitor/notification/__pycache__/wechat.cpython-313.pyc b/gx_gp_monitor/notification/__pycache__/wechat.cpython-313.pyc index c197fbe..8ccbeb2 100644 Binary files a/gx_gp_monitor/notification/__pycache__/wechat.cpython-313.pyc and b/gx_gp_monitor/notification/__pycache__/wechat.cpython-313.pyc differ diff --git a/logs/cron.log b/logs/cron.log new file mode 100644 index 0000000..ed59d4c --- /dev/null +++ b/logs/cron.log @@ -0,0 +1,4 @@ +/opt/1panel/task/shell/广西政府采购网定时监控/广西政府采购网定时监控.sh: line 1: python: command not found +/opt/1panel/task/shell/广西政府采购网定时监控/广西政府采购网定时监控.sh: line 1: python: command not found +/opt/1panel/task/shell/广西政府采购网定时监控/广西政府采购网定时监控.sh: line 1: python: command not found +/opt/1panel/task/shell/广西政府采购网定时监控/广西政府采购网定时监控.sh: line 1: python: command not found diff --git a/logs/gx_gp_monitor.log b/logs/gx_gp_monitor.log index 917e837..6f9d4fb 100644 --- a/logs/gx_gp_monitor.log +++ b/logs/gx_gp_monitor.log @@ -4018,3 +4018,597 @@ 2026-01-08 18:21:45 - gx_gp_monitor.notification.wechat - INFO - 第 8/9 段消息发送成功 2026-01-08 18:21:46 - gx_gp_monitor.notification.wechat - INFO - Markdown消息发送成功 2026-01-08 18:21:46 - gx_gp_monitor.notification.wechat - INFO - 第 9/9 段消息发送成功 +2026-01-08 18:31:31 - gx_gp_monitor.main - INFO - === 广西政府采购网公告监控系统启动 === +2026-01-08 18:31:31 - gx_gp_monitor.main - INFO - 版本: 1.0.0 +2026-01-08 18:31:31 - gx_gp_monitor.main - INFO - 配置文件: 默认配置 +2026-01-08 18:31:32 - gx_gp_monitor.core.reliability - INFO - 健康检查通过 +2026-01-08 18:31:32 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:31:32 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:31:32 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:31:32 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:31:32 - gx_gp_monitor.main - INFO - 应用初始化完成 +2026-01-08 18:31:32 - gx_gp_monitor.main - INFO - 开始执行爬取任务 (手动爬取: True) +2026-01-08 18:31:32 - gx_gp_monitor.crawler.spider - INFO - 开始爬取 13 个公告来源 +2026-01-08 18:31:32 - gx_gp_monitor - INFO - 开始爬取 采购公告 +2026-01-08 18:32:02 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:02 - gx_gp_monitor - INFO - 采购公告 爬取完成,共获取 100 条公告,耗时 30.49秒 +2026-01-08 18:32:02 - gx_gp_monitor - INFO - 开始爬取 结果公告 +2026-01-08 18:32:02 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:02 - gx_gp_monitor - INFO - 结果公告 爬取完成,共获取 100 条公告,耗时 0.25秒 +2026-01-08 18:32:02 - gx_gp_monitor - INFO - 开始爬取 合同公告 +2026-01-08 18:32:03 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:03 - gx_gp_monitor - INFO - 合同公告 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:32:03 - gx_gp_monitor - INFO - 开始爬取 更正公告 +2026-01-08 18:32:03 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:03 - gx_gp_monitor - INFO - 更正公告 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:32:03 - gx_gp_monitor - INFO - 开始爬取 招标文件预公示 +2026-01-08 18:32:03 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:03 - gx_gp_monitor - INFO - 招标文件预公示 爬取完成,共获取 100 条公告,耗时 0.17秒 +2026-01-08 18:32:03 - gx_gp_monitor - INFO - 开始爬取 单一来源公示 +2026-01-08 18:32:03 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:03 - gx_gp_monitor - INFO - 单一来源公示 爬取完成,共获取 100 条公告,耗时 0.26秒 +2026-01-08 18:32:03 - gx_gp_monitor - INFO - 开始爬取 电子卖场公示 +2026-01-08 18:32:04 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 电子卖场公示 爬取完成,共获取 100 条公告,耗时 0.36秒 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 开始爬取 履约验收公示 +2026-01-08 18:32:04 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 履约验收公示 爬取完成,共获取 100 条公告,耗时 0.17秒 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 开始爬取 工程类公告 +2026-01-08 18:32:04 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 工程类公告 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 开始爬取 框架协议征集公告 +2026-01-08 18:32:04 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 框架协议征集公告 爬取完成,共获取 100 条公告,耗时 0.16秒 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 开始爬取 框架协议入围结果公告 +2026-01-08 18:32:04 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 框架协议入围结果公告 爬取完成,共获取 100 条公告,耗时 0.16秒 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 开始爬取 框架协议成交结果汇总公告 +2026-01-08 18:32:04 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 框架协议成交结果汇总公告 爬取完成,共获取 100 条公告,耗时 0.15秒 +2026-01-08 18:32:04 - gx_gp_monitor - INFO - 开始爬取 采购意向公开 +2026-01-08 18:32:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:32:05 - gx_gp_monitor - INFO - 采购意向公开 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 18:32:05 - gx_gp_monitor.crawler.spider - INFO - 爬取完成: 共处理 13 个来源,成功 13 个,失败 0 个,获取 1300 条公告 +2026-01-08 18:32:05 - gx_gp_monitor.main - INFO - 爬取到 1300 条原始公告 +2026-01-08 18:32:05 - gx_gp_monitor.main - INFO - 手动爬取模式:跳过数据库保存 +2026-01-08 18:32:05 - gx_gp_monitor.filters.filters - INFO - 日期筛选: 1300 -> 519 条公告 +2026-01-08 18:32:05 - gx_gp_monitor.filters.filters - INFO - 关键词筛选: 519 -> 0 条公告 +2026-01-08 18:32:05 - gx_gp_monitor.filters.filters - INFO - 来源筛选: 0 -> 0 条公告 +2026-01-08 18:32:05 - gx_gp_monitor.main - INFO - 筛选后剩余 0 条公告 +2026-01-08 18:32:05 - gx_gp_monitor.main - INFO - 手动爬取模式:跳过筛选后公告的数据库保存 +2026-01-08 18:32:05 - gx_gp_monitor.main - INFO - 爬取任务完成: {'success': True, 'total_crawled': 1300, 'filtered': 0, 'saved': 0, 'markdown_generated': False, 'notification_sent': False, 'filter_stats': {'keyword_filtered': 519, 'date_filtered': 781, 'duplicate_filtered': 0, 'source_filtered': 0}, 'filtered_announcements': []} +2026-01-08 18:33:24 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:33:24 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:33:24 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:33:24 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:33:43 - __main__ - INFO - === 开始定时爬取任务 === +2026-01-08 18:33:43 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:33:43 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:33:43 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:33:43 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:33:43 - __main__ - INFO - 开始执行爬取... +2026-01-08 18:33:43 - gx_gp_monitor.core.reliability - INFO - 健康检查通过 +2026-01-08 18:33:43 - gx_gp_monitor.crawler.spider - INFO - 开始爬取 13 个公告来源 +2026-01-08 18:33:43 - gx_gp_monitor - INFO - 开始爬取 采购公告 +2026-01-08 18:33:43 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:43 - gx_gp_monitor - INFO - 采购公告 爬取完成,共获取 100 条公告,耗时 0.44秒 +2026-01-08 18:33:43 - gx_gp_monitor - INFO - 开始爬取 结果公告 +2026-01-08 18:33:44 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 结果公告 爬取完成,共获取 100 条公告,耗时 0.23秒 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 开始爬取 合同公告 +2026-01-08 18:33:44 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 合同公告 爬取完成,共获取 100 条公告,耗时 0.20秒 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 开始爬取 更正公告 +2026-01-08 18:33:44 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 更正公告 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 开始爬取 招标文件预公示 +2026-01-08 18:33:44 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 招标文件预公示 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 开始爬取 单一来源公示 +2026-01-08 18:33:44 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 单一来源公示 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:33:44 - gx_gp_monitor - INFO - 开始爬取 电子卖场公示 +2026-01-08 18:33:45 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 电子卖场公示 爬取完成,共获取 100 条公告,耗时 0.33秒 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 开始爬取 履约验收公示 +2026-01-08 18:33:45 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 履约验收公示 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 开始爬取 工程类公告 +2026-01-08 18:33:45 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 工程类公告 爬取完成,共获取 100 条公告,耗时 0.16秒 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 开始爬取 框架协议征集公告 +2026-01-08 18:33:45 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 框架协议征集公告 爬取完成,共获取 100 条公告,耗时 0.16秒 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 开始爬取 框架协议入围结果公告 +2026-01-08 18:33:45 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 框架协议入围结果公告 爬取完成,共获取 100 条公告,耗时 0.21秒 +2026-01-08 18:33:45 - gx_gp_monitor - INFO - 开始爬取 框架协议成交结果汇总公告 +2026-01-08 18:33:46 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:46 - gx_gp_monitor - INFO - 框架协议成交结果汇总公告 爬取完成,共获取 100 条公告,耗时 0.17秒 +2026-01-08 18:33:46 - gx_gp_monitor - INFO - 开始爬取 采购意向公开 +2026-01-08 18:33:46 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:33:46 - gx_gp_monitor - INFO - 采购意向公开 爬取完成,共获取 100 条公告,耗时 0.17秒 +2026-01-08 18:33:46 - gx_gp_monitor.crawler.spider - INFO - 爬取完成: 共处理 13 个来源,成功 13 个,失败 0 个,获取 1300 条公告 +2026-01-08 18:33:46 - __main__ - INFO - 爬取到 1300 条原始公告 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 开始按来源保存 1300 条公告,每个来源最多保留 100 条 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement1 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement2 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement3 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement4 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement5 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement6 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement7 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement10 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement11 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement20 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement21 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement23 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 来源 61-266648 保存了 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.storage.postgresql - INFO - 按来源保存完成,总计保存 0 条公告 +2026-01-08 18:33:46 - __main__ - INFO - 保存所有公告完成:共保存 0 条,按来源统计: {'ZcyAnnouncement1': 0, 'ZcyAnnouncement2': 0, 'ZcyAnnouncement3': 0, 'ZcyAnnouncement4': 0, 'ZcyAnnouncement5': 0, 'ZcyAnnouncement6': 0, 'ZcyAnnouncement7': 0, 'ZcyAnnouncement10': 0, 'ZcyAnnouncement11': 0, 'ZcyAnnouncement20': 0, 'ZcyAnnouncement21': 0, 'ZcyAnnouncement23': 0, '61-266648': 0} +2026-01-08 18:33:46 - __main__ - INFO - 筛选出 1300 条新公告 +2026-01-08 18:33:46 - gx_gp_monitor.filters.filters - INFO - 来源筛选: 1300 -> 1300 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.filters.filters - INFO - 去重筛选: 移除了 1300 条重复公告 +2026-01-08 18:33:46 - gx_gp_monitor.filters.filters - INFO - 关键词筛选: 0 -> 0 条公告 +2026-01-08 18:33:46 - gx_gp_monitor.filters.filters - INFO - 筛选完成: 总数 1300 -> 筛选后 0 (关键词: 0, 日期: 0, 去重: 1300, 来源: 0) +2026-01-08 18:33:46 - __main__ - INFO - 关键词筛选后剩余 0 条公告 +2026-01-08 18:33:46 - __main__ - INFO - 没有匹配关键词的公告,任务完成 +2026-01-08 18:34:22 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:34:22 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:34:22 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:34:22 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:48:58 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:48:58 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:48:58 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:48:58 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:49:47 - __main__ - INFO - === 开始定时爬取任务 === +2026-01-08 18:49:47 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:49:47 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:49:47 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:49:47 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:49:47 - __main__ - INFO - 开始执行爬取... +2026-01-08 18:49:48 - gx_gp_monitor.core.reliability - INFO - 健康检查通过 +2026-01-08 18:49:48 - gx_gp_monitor.crawler.spider - INFO - 开始爬取 13 个公告来源 +2026-01-08 18:49:48 - gx_gp_monitor - INFO - 开始爬取 采购公告 +2026-01-08 18:49:48 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:48 - gx_gp_monitor - INFO - 采购公告 爬取完成,共获取 100 条公告,耗时 0.47秒 +2026-01-08 18:49:48 - gx_gp_monitor - INFO - 开始爬取 结果公告 +2026-01-08 18:49:48 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:48 - gx_gp_monitor - INFO - 结果公告 爬取完成,共获取 100 条公告,耗时 0.21秒 +2026-01-08 18:49:48 - gx_gp_monitor - INFO - 开始爬取 合同公告 +2026-01-08 18:49:48 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:48 - gx_gp_monitor - INFO - 合同公告 爬取完成,共获取 100 条公告,耗时 0.24秒 +2026-01-08 18:49:48 - gx_gp_monitor - INFO - 开始爬取 更正公告 +2026-01-08 18:49:49 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 更正公告 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 开始爬取 招标文件预公示 +2026-01-08 18:49:49 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 招标文件预公示 爬取完成,共获取 100 条公告,耗时 0.17秒 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 开始爬取 单一来源公示 +2026-01-08 18:49:49 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 单一来源公示 爬取完成,共获取 100 条公告,耗时 0.16秒 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 开始爬取 电子卖场公示 +2026-01-08 18:49:49 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 电子卖场公示 爬取完成,共获取 100 条公告,耗时 0.35秒 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 开始爬取 履约验收公示 +2026-01-08 18:49:49 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 履约验收公示 爬取完成,共获取 100 条公告,耗时 0.16秒 +2026-01-08 18:49:49 - gx_gp_monitor - INFO - 开始爬取 工程类公告 +2026-01-08 18:49:50 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:50 - gx_gp_monitor - INFO - 工程类公告 爬取完成,共获取 100 条公告,耗时 0.24秒 +2026-01-08 18:49:50 - gx_gp_monitor - INFO - 开始爬取 框架协议征集公告 +2026-01-08 18:49:50 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:50 - gx_gp_monitor - INFO - 框架协议征集公告 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:49:50 - gx_gp_monitor - INFO - 开始爬取 框架协议入围结果公告 +2026-01-08 18:49:50 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:50 - gx_gp_monitor - INFO - 框架协议入围结果公告 爬取完成,共获取 100 条公告,耗时 0.26秒 +2026-01-08 18:49:50 - gx_gp_monitor - INFO - 开始爬取 框架协议成交结果汇总公告 +2026-01-08 18:49:50 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:50 - gx_gp_monitor - INFO - 框架协议成交结果汇总公告 爬取完成,共获取 100 条公告,耗时 0.20秒 +2026-01-08 18:49:50 - gx_gp_monitor - INFO - 开始爬取 采购意向公开 +2026-01-08 18:49:51 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:49:51 - gx_gp_monitor - INFO - 采购意向公开 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:49:51 - gx_gp_monitor.crawler.spider - INFO - 爬取完成: 共处理 13 个来源,成功 13 个,失败 0 个,获取 1300 条公告 +2026-01-08 18:49:51 - __main__ - INFO - 爬取到 1300 条原始公告 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 开始按来源保存 1300 条公告,每个来源最多保留 100 条 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement1 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement2 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement3 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement4 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement5 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement6 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement7 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement10 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement11 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement20 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement21 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement23 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 来源 61-266648 保存了 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.storage.postgresql - INFO - 按来源保存完成,总计保存 0 条公告 +2026-01-08 18:49:51 - __main__ - INFO - 保存所有公告完成:共保存 0 条,按来源统计: {'ZcyAnnouncement1': 0, 'ZcyAnnouncement2': 0, 'ZcyAnnouncement3': 0, 'ZcyAnnouncement4': 0, 'ZcyAnnouncement5': 0, 'ZcyAnnouncement6': 0, 'ZcyAnnouncement7': 0, 'ZcyAnnouncement10': 0, 'ZcyAnnouncement11': 0, 'ZcyAnnouncement20': 0, 'ZcyAnnouncement21': 0, 'ZcyAnnouncement23': 0, '61-266648': 0} +2026-01-08 18:49:51 - __main__ - INFO - 筛选出 1300 条新公告 +2026-01-08 18:49:51 - gx_gp_monitor.filters.filters - INFO - 来源筛选: 1300 -> 1300 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.filters.filters - INFO - 去重筛选: 移除了 1300 条重复公告 +2026-01-08 18:49:51 - gx_gp_monitor.filters.filters - INFO - 关键词筛选: 0 -> 0 条公告 +2026-01-08 18:49:51 - gx_gp_monitor.filters.filters - INFO - 筛选完成: 总数 1300 -> 筛选后 0 (关键词: 0, 日期: 0, 去重: 1300, 来源: 0) +2026-01-08 18:49:51 - __main__ - INFO - 关键词筛选后剩余 0 条公告 +2026-01-08 18:49:51 - __main__ - INFO - 没有匹配关键词的公告,任务完成 +2026-01-08 18:56:04 - __main__ - INFO - === 开始定时爬取任务 === +2026-01-08 18:56:04 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:56:04 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:56:04 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:56:04 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:56:04 - __main__ - INFO - 开始执行爬取... +2026-01-08 18:56:04 - gx_gp_monitor.core.reliability - INFO - 健康检查通过 +2026-01-08 18:56:04 - gx_gp_monitor.crawler.spider - INFO - 开始爬取 13 个公告来源 +2026-01-08 18:56:04 - gx_gp_monitor - INFO - 开始爬取 采购公告 +2026-01-08 18:56:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 采购公告 爬取完成,共获取 100 条公告,耗时 0.34秒 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 开始爬取 结果公告 +2026-01-08 18:56:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 结果公告 爬取完成,共获取 100 条公告,耗时 0.17秒 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 开始爬取 合同公告 +2026-01-08 18:56:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 合同公告 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 开始爬取 更正公告 +2026-01-08 18:56:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 更正公告 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 开始爬取 招标文件预公示 +2026-01-08 18:56:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 招标文件预公示 爬取完成,共获取 100 条公告,耗时 0.20秒 +2026-01-08 18:56:05 - gx_gp_monitor - INFO - 开始爬取 单一来源公示 +2026-01-08 18:56:06 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:06 - gx_gp_monitor - INFO - 单一来源公示 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:56:06 - gx_gp_monitor - INFO - 开始爬取 电子卖场公示 +2026-01-08 18:56:06 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:06 - gx_gp_monitor - INFO - 电子卖场公示 爬取完成,共获取 100 条公告,耗时 0.36秒 +2026-01-08 18:56:06 - gx_gp_monitor - INFO - 开始爬取 履约验收公示 +2026-01-08 18:56:06 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:06 - gx_gp_monitor - INFO - 履约验收公示 爬取完成,共获取 100 条公告,耗时 0.16秒 +2026-01-08 18:56:06 - gx_gp_monitor - INFO - 开始爬取 工程类公告 +2026-01-08 18:56:06 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:06 - gx_gp_monitor - INFO - 工程类公告 爬取完成,共获取 100 条公告,耗时 0.24秒 +2026-01-08 18:56:06 - gx_gp_monitor - INFO - 开始爬取 框架协议征集公告 +2026-01-08 18:56:07 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:07 - gx_gp_monitor - INFO - 框架协议征集公告 爬取完成,共获取 100 条公告,耗时 0.21秒 +2026-01-08 18:56:07 - gx_gp_monitor - INFO - 开始爬取 框架协议入围结果公告 +2026-01-08 18:56:07 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:07 - gx_gp_monitor - INFO - 框架协议入围结果公告 爬取完成,共获取 100 条公告,耗时 0.15秒 +2026-01-08 18:56:07 - gx_gp_monitor - INFO - 开始爬取 框架协议成交结果汇总公告 +2026-01-08 18:56:07 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:07 - gx_gp_monitor - INFO - 框架协议成交结果汇总公告 爬取完成,共获取 100 条公告,耗时 0.20秒 +2026-01-08 18:56:07 - gx_gp_monitor - INFO - 开始爬取 采购意向公开 +2026-01-08 18:56:07 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:56:07 - gx_gp_monitor - INFO - 采购意向公开 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:56:07 - gx_gp_monitor.crawler.spider - INFO - 爬取完成: 共处理 13 个来源,成功 13 个,失败 0 个,获取 1300 条公告 +2026-01-08 18:56:07 - __main__ - INFO - 爬取到 1300 条原始公告 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 开始按来源保存 1300 条公告,每个来源最多保留 100 条 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement1 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement2 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement3 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement4 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement5 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement6 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement7 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement10 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement11 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement20 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement21 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement23 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 61-266648 保存了 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.storage.postgresql - INFO - 按来源保存完成,总计保存 0 条公告 +2026-01-08 18:56:07 - __main__ - INFO - 保存所有公告完成:共保存 0 条,按来源统计: {'ZcyAnnouncement1': 0, 'ZcyAnnouncement2': 0, 'ZcyAnnouncement3': 0, 'ZcyAnnouncement4': 0, 'ZcyAnnouncement5': 0, 'ZcyAnnouncement6': 0, 'ZcyAnnouncement7': 0, 'ZcyAnnouncement10': 0, 'ZcyAnnouncement11': 0, 'ZcyAnnouncement20': 0, 'ZcyAnnouncement21': 0, 'ZcyAnnouncement23': 0, '61-266648': 0} +2026-01-08 18:56:07 - __main__ - INFO - 筛选出 1300 条新公告 +2026-01-08 18:56:07 - gx_gp_monitor.filters.filters - INFO - 来源筛选: 1300 -> 1300 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.filters.filters - INFO - 去重筛选: 移除了 1300 条重复公告 +2026-01-08 18:56:07 - gx_gp_monitor.filters.filters - INFO - 关键词筛选: 0 -> 0 条公告 +2026-01-08 18:56:07 - gx_gp_monitor.filters.filters - INFO - 筛选完成: 总数 1300 -> 筛选后 0 (关键词: 0, 日期: 0, 去重: 1300, 来源: 0) +2026-01-08 18:56:07 - __main__ - INFO - 关键词筛选后剩余 0 条公告 +2026-01-08 18:56:07 - __main__ - INFO - 没有匹配关键词的公告,任务完成 +2026-01-08 18:56:42 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:56:42 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:56:42 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:56:42 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:58:26 - __main__ - INFO - === 开始定时爬取任务 === +2026-01-08 18:58:26 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:58:26 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:58:26 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:58:26 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:58:26 - __main__ - INFO - 开始执行爬取... +2026-01-08 18:58:26 - gx_gp_monitor.core.reliability - INFO - 健康检查通过 +2026-01-08 18:58:26 - gx_gp_monitor.crawler.spider - INFO - 开始爬取 13 个公告来源 +2026-01-08 18:58:26 - gx_gp_monitor - INFO - 开始爬取 采购公告 +2026-01-08 18:59:28 - __main__ - INFO - === 开始定时爬取任务 === +2026-01-08 18:59:28 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 18:59:28 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 18:59:28 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 18:59:28 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 18:59:28 - __main__ - INFO - 开始执行爬取... +2026-01-08 18:59:28 - gx_gp_monitor.core.reliability - INFO - 健康检查通过 +2026-01-08 18:59:28 - gx_gp_monitor.crawler.spider - INFO - 开始爬取 13 个公告来源 +2026-01-08 18:59:28 - gx_gp_monitor - INFO - 开始爬取 采购公告 +2026-01-08 18:59:58 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:59:58 - gx_gp_monitor - INFO - 采购公告 爬取完成,共获取 100 条公告,耗时 30.44秒 +2026-01-08 18:59:58 - gx_gp_monitor - INFO - 开始爬取 结果公告 +2026-01-08 18:59:58 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:59:58 - gx_gp_monitor - INFO - 结果公告 爬取完成,共获取 100 条公告,耗时 0.22秒 +2026-01-08 18:59:58 - gx_gp_monitor - INFO - 开始爬取 合同公告 +2026-01-08 18:59:59 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:59:59 - gx_gp_monitor - INFO - 合同公告 爬取完成,共获取 100 条公告,耗时 0.24秒 +2026-01-08 18:59:59 - gx_gp_monitor - INFO - 开始爬取 更正公告 +2026-01-08 18:59:59 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:59:59 - gx_gp_monitor - INFO - 更正公告 爬取完成,共获取 100 条公告,耗时 0.22秒 +2026-01-08 18:59:59 - gx_gp_monitor - INFO - 开始爬取 招标文件预公示 +2026-01-08 18:59:59 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:59:59 - gx_gp_monitor - INFO - 招标文件预公示 爬取完成,共获取 100 条公告,耗时 0.20秒 +2026-01-08 18:59:59 - gx_gp_monitor - INFO - 开始爬取 单一来源公示 +2026-01-08 18:59:59 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 18:59:59 - gx_gp_monitor - INFO - 单一来源公示 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 18:59:59 - gx_gp_monitor - INFO - 开始爬取 电子卖场公示 +2026-01-08 19:00:00 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:00 - gx_gp_monitor - INFO - 电子卖场公示 爬取完成,共获取 100 条公告,耗时 0.41秒 +2026-01-08 19:00:00 - gx_gp_monitor - INFO - 开始爬取 履约验收公示 +2026-01-08 19:00:00 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:00 - gx_gp_monitor - INFO - 履约验收公示 爬取完成,共获取 100 条公告,耗时 0.21秒 +2026-01-08 19:00:00 - gx_gp_monitor - INFO - 开始爬取 工程类公告 +2026-01-08 19:00:00 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:00 - gx_gp_monitor - INFO - 工程类公告 爬取完成,共获取 100 条公告,耗时 0.20秒 +2026-01-08 19:00:00 - gx_gp_monitor - INFO - 开始爬取 框架协议征集公告 +2026-01-08 19:00:00 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:00 - gx_gp_monitor - INFO - 框架协议征集公告 爬取完成,共获取 100 条公告,耗时 0.20秒 +2026-01-08 19:00:00 - gx_gp_monitor - INFO - 开始爬取 框架协议入围结果公告 +2026-01-08 19:00:01 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:01 - gx_gp_monitor - INFO - 框架协议入围结果公告 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 19:00:01 - gx_gp_monitor - INFO - 开始爬取 框架协议成交结果汇总公告 +2026-01-08 19:00:01 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:01 - gx_gp_monitor - INFO - 框架协议成交结果汇总公告 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 19:00:01 - gx_gp_monitor - INFO - 开始爬取 采购意向公开 +2026-01-08 19:00:01 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:01 - gx_gp_monitor - INFO - 采购意向公开 爬取完成,共获取 100 条公告,耗时 0.26秒 +2026-01-08 19:00:01 - gx_gp_monitor.crawler.spider - INFO - 爬取完成: 共处理 13 个来源,成功 13 个,失败 0 个,获取 1300 条公告 +2026-01-08 19:00:01 - __main__ - INFO - 爬取到 1300 条原始公告 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 开始按来源保存 1300 条公告,每个来源最多保留 100 条 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement1 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement2 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement3 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement4 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement5 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement6 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement7 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement10 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement11 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement20 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement21 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement23 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 来源 61-266648 保存了 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.storage.postgresql - INFO - 按来源保存完成,总计保存 0 条公告 +2026-01-08 19:00:01 - __main__ - INFO - 保存所有公告完成:共保存 0 条,按来源统计: {'ZcyAnnouncement1': 0, 'ZcyAnnouncement2': 0, 'ZcyAnnouncement3': 0, 'ZcyAnnouncement4': 0, 'ZcyAnnouncement5': 0, 'ZcyAnnouncement6': 0, 'ZcyAnnouncement7': 0, 'ZcyAnnouncement10': 0, 'ZcyAnnouncement11': 0, 'ZcyAnnouncement20': 0, 'ZcyAnnouncement21': 0, 'ZcyAnnouncement23': 0, '61-266648': 0} +2026-01-08 19:00:01 - __main__ - INFO - 筛选出 1300 条新公告 +2026-01-08 19:00:01 - gx_gp_monitor.filters.filters - INFO - 来源筛选: 1300 -> 1300 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.filters.filters - INFO - 去重筛选: 移除了 1300 条重复公告 +2026-01-08 19:00:01 - gx_gp_monitor.filters.filters - INFO - 关键词筛选: 0 -> 0 条公告 +2026-01-08 19:00:01 - gx_gp_monitor.filters.filters - INFO - 筛选完成: 总数 1300 -> 筛选后 0 (关键词: 0, 日期: 0, 去重: 1300, 来源: 0) +2026-01-08 19:00:01 - __main__ - INFO - 关键词筛选后剩余 0 条公告 +2026-01-08 19:00:01 - __main__ - INFO - 没有匹配关键词的公告,任务完成 +2026-01-08 19:00:04 - __main__ - INFO - === 开始定时爬取任务 === +2026-01-08 19:00:04 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 19:00:04 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 19:00:04 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 19:00:04 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 19:00:04 - __main__ - INFO - 开始执行爬取... +2026-01-08 19:00:04 - gx_gp_monitor.core.reliability - INFO - 健康检查通过 +2026-01-08 19:00:04 - gx_gp_monitor.crawler.spider - INFO - 开始爬取 13 个公告来源 +2026-01-08 19:00:04 - gx_gp_monitor - INFO - 开始爬取 采购公告 +2026-01-08 19:00:04 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:04 - gx_gp_monitor - INFO - 采购公告 爬取完成,共获取 100 条公告,耗时 0.40秒 +2026-01-08 19:00:04 - gx_gp_monitor - INFO - 开始爬取 结果公告 +2026-01-08 19:00:04 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:04 - gx_gp_monitor - INFO - 结果公告 爬取完成,共获取 100 条公告,耗时 0.21秒 +2026-01-08 19:00:04 - gx_gp_monitor - INFO - 开始爬取 合同公告 +2026-01-08 19:00:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:05 - gx_gp_monitor - INFO - 合同公告 爬取完成,共获取 100 条公告,耗时 0.20秒 +2026-01-08 19:00:05 - gx_gp_monitor - INFO - 开始爬取 更正公告 +2026-01-08 19:00:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:05 - gx_gp_monitor - INFO - 更正公告 爬取完成,共获取 100 条公告,耗时 0.21秒 +2026-01-08 19:00:05 - gx_gp_monitor - INFO - 开始爬取 招标文件预公示 +2026-01-08 19:00:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:05 - gx_gp_monitor - INFO - 招标文件预公示 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 19:00:05 - gx_gp_monitor - INFO - 开始爬取 单一来源公示 +2026-01-08 19:00:05 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:05 - gx_gp_monitor - INFO - 单一来源公示 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 19:00:05 - gx_gp_monitor - INFO - 开始爬取 电子卖场公示 +2026-01-08 19:00:06 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 电子卖场公示 爬取完成,共获取 100 条公告,耗时 0.37秒 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 开始爬取 履约验收公示 +2026-01-08 19:00:06 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 履约验收公示 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 开始爬取 工程类公告 +2026-01-08 19:00:06 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 工程类公告 爬取完成,共获取 100 条公告,耗时 0.17秒 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 开始爬取 框架协议征集公告 +2026-01-08 19:00:06 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 框架协议征集公告 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 开始爬取 框架协议入围结果公告 +2026-01-08 19:00:06 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 框架协议入围结果公告 爬取完成,共获取 100 条公告,耗时 0.25秒 +2026-01-08 19:00:06 - gx_gp_monitor - INFO - 开始爬取 框架协议成交结果汇总公告 +2026-01-08 19:00:07 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:07 - gx_gp_monitor - INFO - 框架协议成交结果汇总公告 爬取完成,共获取 100 条公告,耗时 0.21秒 +2026-01-08 19:00:07 - gx_gp_monitor - INFO - 开始爬取 采购意向公开 +2026-01-08 19:00:07 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:00:07 - gx_gp_monitor - INFO - 采购意向公开 爬取完成,共获取 100 条公告,耗时 0.22秒 +2026-01-08 19:00:07 - gx_gp_monitor.crawler.spider - INFO - 爬取完成: 共处理 13 个来源,成功 13 个,失败 0 个,获取 1300 条公告 +2026-01-08 19:00:07 - __main__ - INFO - 爬取到 1300 条原始公告 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 开始按来源保存 1300 条公告,每个来源最多保留 100 条 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement1 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement2 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement3 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement4 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement5 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement6 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement7 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement10 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement11 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement20 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement21 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement23 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 来源 61-266648 保存了 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.storage.postgresql - INFO - 按来源保存完成,总计保存 0 条公告 +2026-01-08 19:00:07 - __main__ - INFO - 保存所有公告完成:共保存 0 条,按来源统计: {'ZcyAnnouncement1': 0, 'ZcyAnnouncement2': 0, 'ZcyAnnouncement3': 0, 'ZcyAnnouncement4': 0, 'ZcyAnnouncement5': 0, 'ZcyAnnouncement6': 0, 'ZcyAnnouncement7': 0, 'ZcyAnnouncement10': 0, 'ZcyAnnouncement11': 0, 'ZcyAnnouncement20': 0, 'ZcyAnnouncement21': 0, 'ZcyAnnouncement23': 0, '61-266648': 0} +2026-01-08 19:00:07 - __main__ - INFO - 筛选出 1300 条新公告 +2026-01-08 19:00:07 - gx_gp_monitor.filters.filters - INFO - 来源筛选: 1300 -> 1300 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.filters.filters - INFO - 去重筛选: 移除了 1300 条重复公告 +2026-01-08 19:00:07 - gx_gp_monitor.filters.filters - INFO - 关键词筛选: 0 -> 0 条公告 +2026-01-08 19:00:07 - gx_gp_monitor.filters.filters - INFO - 筛选完成: 总数 1300 -> 筛选后 0 (关键词: 0, 日期: 0, 去重: 1300, 来源: 0) +2026-01-08 19:00:07 - __main__ - INFO - 关键词筛选后剩余 0 条公告 +2026-01-08 19:00:07 - __main__ - INFO - 没有匹配关键词的公告,任务完成 +2026-01-08 19:02:07 - __main__ - INFO - === 开始定时爬取任务 === +2026-01-08 19:02:07 - gx_gp_monitor.core.database - INFO - 数据库连接池初始化成功 +2026-01-08 19:02:07 - gx_gp_monitor.core.database - INFO - 开始初始化数据库表结构 +2026-01-08 19:02:07 - gx_gp_monitor.core.database - INFO - 数据库表结构初始化完成 +2026-01-08 19:02:08 - gx_gp_monitor.storage.postgresql - INFO - 存储初始化完成 +2026-01-08 19:02:08 - __main__ - INFO - 开始执行爬取... +2026-01-08 19:02:08 - gx_gp_monitor.core.reliability - INFO - 健康检查通过 +2026-01-08 19:02:08 - gx_gp_monitor.crawler.spider - INFO - 开始爬取 13 个公告来源 +2026-01-08 19:02:08 - gx_gp_monitor - INFO - 开始爬取 采购公告 +2026-01-08 19:02:38 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:38 - gx_gp_monitor - INFO - 采购公告 爬取完成,共获取 100 条公告,耗时 30.40秒 +2026-01-08 19:02:38 - gx_gp_monitor - INFO - 开始爬取 结果公告 +2026-01-08 19:02:38 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:38 - gx_gp_monitor - INFO - 结果公告 爬取完成,共获取 100 条公告,耗时 0.22秒 +2026-01-08 19:02:38 - gx_gp_monitor - INFO - 开始爬取 合同公告 +2026-01-08 19:02:39 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:39 - gx_gp_monitor - INFO - 合同公告 爬取完成,共获取 100 条公告,耗时 0.21秒 +2026-01-08 19:02:39 - gx_gp_monitor - INFO - 开始爬取 更正公告 +2026-01-08 19:02:39 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:39 - gx_gp_monitor - INFO - 更正公告 爬取完成,共获取 100 条公告,耗时 0.29秒 +2026-01-08 19:02:39 - gx_gp_monitor - INFO - 开始爬取 招标文件预公示 +2026-01-08 19:02:39 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:39 - gx_gp_monitor - INFO - 招标文件预公示 爬取完成,共获取 100 条公告,耗时 0.23秒 +2026-01-08 19:02:39 - gx_gp_monitor - INFO - 开始爬取 单一来源公示 +2026-01-08 19:02:39 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:39 - gx_gp_monitor - INFO - 单一来源公示 爬取完成,共获取 100 条公告,耗时 0.20秒 +2026-01-08 19:02:39 - gx_gp_monitor - INFO - 开始爬取 电子卖场公示 +2026-01-08 19:02:40 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 电子卖场公示 爬取完成,共获取 100 条公告,耗时 0.36秒 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 开始爬取 履约验收公示 +2026-01-08 19:02:40 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 履约验收公示 爬取完成,共获取 100 条公告,耗时 0.21秒 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 开始爬取 工程类公告 +2026-01-08 19:02:40 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 工程类公告 爬取完成,共获取 100 条公告,耗时 0.27秒 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 开始爬取 框架协议征集公告 +2026-01-08 19:02:40 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 框架协议征集公告 爬取完成,共获取 100 条公告,耗时 0.18秒 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 开始爬取 框架协议入围结果公告 +2026-01-08 19:02:40 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 框架协议入围结果公告 爬取完成,共获取 100 条公告,耗时 0.22秒 +2026-01-08 19:02:40 - gx_gp_monitor - INFO - 开始爬取 框架协议成交结果汇总公告 +2026-01-08 19:02:41 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:41 - gx_gp_monitor - INFO - 框架协议成交结果汇总公告 爬取完成,共获取 100 条公告,耗时 0.22秒 +2026-01-08 19:02:41 - gx_gp_monitor - INFO - 开始爬取 采购意向公开 +2026-01-08 19:02:41 - gx_gp_monitor.crawler.parsers - INFO - 成功解析 100/100 条公告记录 +2026-01-08 19:02:41 - gx_gp_monitor - INFO - 采购意向公开 爬取完成,共获取 100 条公告,耗时 0.19秒 +2026-01-08 19:02:41 - gx_gp_monitor.crawler.spider - INFO - 爬取完成: 共处理 13 个来源,成功 13 个,失败 0 个,获取 1300 条公告 +2026-01-08 19:02:41 - __main__ - INFO - 爬取到 1300 条原始公告 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 开始按来源保存 1300 条公告,每个来源最多保留 100 条 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement1 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement2 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement3 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement4 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement5 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement6 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement7 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement10 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement11 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement20 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement21 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 ZcyAnnouncement23 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.core.database - INFO - 批量保存公告完成,成功保存 0 条 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 来源 61-266648 保存了 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.storage.postgresql - INFO - 按来源保存完成,总计保存 0 条公告 +2026-01-08 19:02:41 - __main__ - INFO - 保存所有公告完成:共保存 0 条,按来源统计: {'ZcyAnnouncement1': 0, 'ZcyAnnouncement2': 0, 'ZcyAnnouncement3': 0, 'ZcyAnnouncement4': 0, 'ZcyAnnouncement5': 0, 'ZcyAnnouncement6': 0, 'ZcyAnnouncement7': 0, 'ZcyAnnouncement10': 0, 'ZcyAnnouncement11': 0, 'ZcyAnnouncement20': 0, 'ZcyAnnouncement21': 0, 'ZcyAnnouncement23': 0, '61-266648': 0} +2026-01-08 19:02:41 - __main__ - INFO - 筛选出 1300 条新公告 +2026-01-08 19:02:41 - gx_gp_monitor.filters.filters - INFO - 来源筛选: 1300 -> 1300 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.filters.filters - INFO - 去重筛选: 移除了 1300 条重复公告 +2026-01-08 19:02:41 - gx_gp_monitor.filters.filters - INFO - 关键词筛选: 0 -> 0 条公告 +2026-01-08 19:02:41 - gx_gp_monitor.filters.filters - INFO - 筛选完成: 总数 1300 -> 筛选后 0 (关键词: 0, 日期: 0, 去重: 1300, 来源: 0) +2026-01-08 19:02:41 - __main__ - INFO - 关键词筛选后剩余 0 条公告 +2026-01-08 19:02:41 - __main__ - INFO - 没有匹配关键词的公告,任务完成 diff --git a/run_cron_crawl.sh b/run_cron_crawl.sh new file mode 100755 index 0000000..43e624f --- /dev/null +++ b/run_cron_crawl.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# 定时爬取脚本启动器 +# 用于启动广西政府采购网公告定时爬取任务 +# 自动激活项目虚拟环境并运行Python脚本 + +# 设置脚本遇到错误时退出 +set -e + +# 获取脚本所在目录的绝对路径 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$SCRIPT_DIR" + +echo "========================================" +echo "🕒 广西政府采购网公告定时爬取任务" +echo "📂 项目目录: $PROJECT_ROOT" +echo "⏰ 开始时间: $(date '+%Y-%m-%d %H:%M:%S')" +echo "========================================" + +# 检查虚拟环境 +VENV_PATH="$PROJECT_ROOT/venv" +if [ ! -d "$VENV_PATH" ]; then + echo "❌ 错误: 找不到虚拟环境目录" + echo " 预期路径: $VENV_PATH" + echo " 请确保虚拟环境已正确创建" + exit 1 +fi + +# 检查虚拟环境激活脚本 +VENV_ACTIVATE="$VENV_PATH/bin/activate" +if [ ! -f "$VENV_ACTIVATE" ]; then + echo "❌ 错误: 找不到虚拟环境激活脚本" + echo " 预期路径: $VENV_ACTIVATE" + exit 1 +fi + +echo "✅ 找到虚拟环境: $VENV_PATH" + +# 激活虚拟环境 +echo "🔧 激活虚拟环境..." +echo " 激活脚本: $VENV_ACTIVATE" +source "$VENV_ACTIVATE" + +# 检查Python环境(在虚拟环境中) +if ! command -v python &> /dev/null; then + echo "❌ 错误: 虚拟环境中未找到Python命令" + exit 1 +fi + +# 检查Python版本(在虚拟环境中) +PYTHON_VERSION=$(python --version 2>&1 | cut -d' ' -f2 | cut -d. -f1-2) +echo "🐍 Python版本 (虚拟环境): $PYTHON_VERSION" + +# 检查项目目录 +if [ ! -d "$PROJECT_ROOT/gx_gp_monitor" ]; then + echo "❌ 错误: 找不到gx_gp_monitor目录" + echo " 预期路径: $PROJECT_ROOT/gx_gp_monitor" + exit 1 +fi + +# 检查cron_crawl.py文件 +CRON_SCRIPT="$PROJECT_ROOT/gx_gp_monitor/cron_crawl.py" +if [ ! -f "$CRON_SCRIPT" ]; then + echo "❌ 错误: 找不到cron_crawl.py文件" + echo " 预期路径: $CRON_SCRIPT" + exit 1 +fi + +echo "✅ 环境检查通过" +echo "🚀 启动定时爬取脚本..." + +# 切换到项目根目录 +cd "$PROJECT_ROOT" + +# 执行定时爬取脚本 +python "$CRON_SCRIPT" +EXIT_CODE=$? + +echo "========================================" +echo "🏁 任务完成" +echo "📅 结束时间: $(date '+%Y-%m-%d %H:%M:%S')" +echo "🔚 退出代码: $EXIT_CODE" + +if [ $EXIT_CODE -eq 0 ]; then + echo "✅ 任务执行成功" +else + echo "❌ 任务执行失败" +fi + +echo "========================================" +exit $EXIT_CODE diff --git a/test_cron.py b/test_cron.py new file mode 100755 index 0000000..eab194c --- /dev/null +++ b/test_cron.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +""" +测试定时爬取脚本配置 +""" + +import sys +import os + +# 添加项目路径 +sys.path.insert(0, os.path.dirname(__file__)) + +try: + from gx_gp_monitor.core.config_manager import load_config + from gx_gp_monitor.core.logger import init_logger + from gx_gp_monitor.storage.postgresql import init_storage + + def test_config(): + """测试配置加载""" + print("🔍 测试配置加载...") + + config = load_config() + if not config: + print("❌ 配置加载失败") + return False + + print("✅ 配置加载成功") + print(f" 关键词: {config.crawler.keyword}") + print(f" 企业微信启用: {config.wechat_app.enabled}") + print(f" 数据库启用: {config.database.enabled}") + + return True + + def test_logger(): + """测试日志系统""" + print("\n🔍 测试日志系统...") + + try: + init_logger() + print("✅ 日志系统初始化成功") + return True + except Exception as e: + print(f"❌ 日志系统初始化失败: {e}") + return False + + def test_database(): + """测试数据库连接""" + print("\n🔍 测试数据库连接...") + + try: + init_storage() + print("✅ 数据库连接成功") + return True + except Exception as e: + print(f"❌ 数据库连接失败: {e}") + return False + + def main(): + """主测试函数""" + print("🚀 开始测试定时爬取脚本配置\n") + + results = [] + results.append(("配置加载", test_config())) + results.append(("日志系统", test_logger())) + results.append(("数据库连接", test_database())) + + print("\n" + "="*50) + print("📊 测试结果:") + + all_passed = True + for test_name, passed in results: + status = "✅ 通过" if passed else "❌ 失败" + print(f" {test_name}: {status}") + if not passed: + all_passed = False + + print("\n" + "="*50) + if all_passed: + print("🎉 所有测试通过!可以安全使用定时爬取脚本。") + print("\n💡 使用方法:") + print(" 直接运行: python cron_crawl.py") + print(" 定时运行: 参考 CRON_README.md 或 cron_example.txt") + else: + print("⚠️ 部分测试失败,请检查配置后再使用脚本。") + + return all_passed + + if __name__ == "__main__": + success = main() + sys.exit(0 if success else 1) + +except ImportError as e: + print(f"❌ 导入失败: {e}", file=sys.stderr) + print("请确保已安装所有依赖: pip install -r gx_gp_monitor/requirements.txt", file=sys.stderr) + sys.exit(1) +except Exception as e: + print(f"❌ 测试失败: {e}", file=sys.stderr) + sys.exit(1)