feat: 全面升级系统日志和反爬虫功能

- 新增专业日志系统:集成 Winston 日志框架,支持按天轮转和分级存储
- 增强反爬虫能力:集成 puppeteer-extra-plugin-stealth 插件,提升隐蔽性
- 新增独立爬虫脚本:可通过 npm run crawl 命令单独执行爬虫任务
- 优化前端日期筛选:添加日期范围选择器,支持3天/7天快速筛选
- 改进爬虫统计功能:详细记录每个平台的成功/失败情况和执行时间
- 移除默认关键词初始化:避免重复创建预设关键词
- 扩展环境配置:新增 LOG_LEVEL 日志级别配置选项
- 增强.gitignore:添加日志目录、构建产物等忽略规则
- 升级执行时间限制:将最大执行时间从1小时延长至3小时
- 完善错误处理:更好的异常捕获和日志记录机制
This commit is contained in:
dmy
2026-01-12 10:46:10 +08:00
parent 66f535ed0c
commit 3e6456e120
14 changed files with 495 additions and 119 deletions

View File

@@ -1,26 +1,15 @@
import { Injectable, OnModuleInit } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Keyword } from './keyword.entity';
@Injectable()
export class KeywordsService implements OnModuleInit {
export class KeywordsService {
constructor(
@InjectRepository(Keyword)
private keywordRepository: Repository<Keyword>,
) {}
async onModuleInit() {
// 初始预设关键词
const defaultKeywords = ["山东", "海", "建设", "工程", "采购"];
for (const word of defaultKeywords) {
const exists = await this.keywordRepository.findOne({ where: { word } });
if (!exists) {
await this.keywordRepository.save({ word, weight: 1 });
}
}
}
findAll() {
return this.keywordRepository.find();
}