feat(electron): 添加Electron桌面应用支持

- 新增Electron主进程、预加载脚本和构建配置
- 修改前端配置以支持Electron打包
- 更新项目文档和依赖
- 重构API调用使用统一axios实例
This commit is contained in:
dmy
2026-01-15 00:35:19 +08:00
parent f736f30248
commit eca3f4f9fd
22 changed files with 421 additions and 109 deletions

View File

@@ -60,7 +60,6 @@ const appLogTransport = new DailyRotateFile({
datePattern: 'YYYY-MM-DD',
maxSize: '20m',
maxFiles: '30d',
format: logFormat,
});
// 错误日志传输(按天轮转)
@@ -68,16 +67,15 @@ const errorLogTransport = new DailyRotateFile({
dirname: logDir,
filename: 'error-%DATE%.log',
datePattern: 'YYYY-MM-DD',
level: 'error',
maxSize: '20m',
maxFiles: '30d',
format: logFormat,
level: 'error',
});
// 创建 winston logger 实例
export const winstonLogger = winston.createLogger({
level: process.env.LOG_LEVEL || 'info',
format: logFormat,
transports: [consoleTransport, appLogTransport, errorLogTransport],
transports: [consoleTransport, appLogTransport as any, errorLogTransport as any],
exitOnError: false,
});

View File

@@ -24,7 +24,19 @@ interface CrawlResult {
url: string;
}
type AnyCrawler = typeof ChdtpCrawler | typeof ChngCrawler | typeof SzecpCrawler | typeof CdtCrawler | typeof EpsCrawler | typeof CnncecpCrawler | typeof CgnpcCrawler | typeof CeicCrawler | typeof EspicCrawler | typeof PowerbeijingCrawler | typeof SdiccCrawler | typeof CnoocCrawler;
type AnyCrawler =
| typeof ChdtpCrawler
| typeof ChngCrawler
| typeof SzecpCrawler
| typeof CdtCrawler
| typeof EpsCrawler
| typeof CnncecpCrawler
| typeof CgnpcCrawler
| typeof CeicCrawler
| typeof EspicCrawler
| typeof PowerbeijingCrawler
| typeof SdiccCrawler
| typeof CnoocCrawler;
@Injectable()
export class BidCrawlerService {

View File

@@ -1,10 +1,6 @@
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { BidItem } from '../bids/entities/bid-item.entity';
import { Keyword } from '../keywords/keyword.entity';
import { AiRecommendation } from '../ai/entities/ai-recommendation.entity';
import { CrawlInfoAdd } from '../crawler/entities/crawl-info-add.entity';
@Module({
imports: [
@@ -22,7 +18,7 @@ import { CrawlInfoAdd } from '../crawler/entities/crawl-info-add.entity';
username: configService.get<string>('DATABASE_USERNAME', 'root'),
password: configService.get<string>('DATABASE_PASSWORD', 'root'),
database: configService.get<string>('DATABASE_NAME', 'bidding'),
entities: [BidItem, Keyword, AiRecommendation, CrawlInfoAdd],
entities: [__dirname + '/../**/*.entity{.ts,.js}'],
synchronize: false,
}),
}),