feat: 更新AI提示并增强后端功能
更新AI提示字符串包含海南地区 添加CrawlInfoAdd实体到Bids模块 优化爬虫信息统计查询 增加请求体大小限制和启用CORS 修正前端部署路径
This commit is contained in:
@@ -2,12 +2,15 @@ import { Injectable } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository, LessThan, MoreThanOrEqual } from 'typeorm';
|
||||
import { BidItem } from '../entities/bid-item.entity';
|
||||
import { CrawlInfoAdd } from '../../crawler/entities/crawl-info-add.entity';
|
||||
|
||||
@Injectable()
|
||||
export class BidsService {
|
||||
constructor(
|
||||
@InjectRepository(BidItem)
|
||||
private bidRepository: Repository<BidItem>,
|
||||
@InjectRepository(CrawlInfoAdd)
|
||||
private crawlInfoRepository: Repository<CrawlInfoAdd>,
|
||||
) {}
|
||||
|
||||
async findAll(query?: any) {
|
||||
@@ -117,11 +120,7 @@ export class BidsService {
|
||||
}
|
||||
|
||||
async getCrawlInfoAddStats() {
|
||||
const { InjectRepository } = require('@nestjs/typeorm');
|
||||
const { Repository } = require('typeorm');
|
||||
const { CrawlInfoAdd } = require('../../crawler/entities/crawl-info-add.entity');
|
||||
|
||||
// 获取每个来源的最新一次爬虫记录
|
||||
// 获取每个来源的最新一次爬虫记录(按 createdAt 降序)
|
||||
const query = `
|
||||
SELECT
|
||||
source,
|
||||
@@ -130,15 +129,15 @@ export class BidsService {
|
||||
error,
|
||||
createdAt as latestUpdate
|
||||
FROM crawl_info_add
|
||||
WHERE id IN (
|
||||
SELECT MAX(id)
|
||||
WHERE (source, createdAt) IN (
|
||||
SELECT source, MAX(createdAt)
|
||||
FROM crawl_info_add
|
||||
GROUP BY source
|
||||
)
|
||||
ORDER BY source ASC
|
||||
`;
|
||||
|
||||
const results = await this.bidRepository.query(query);
|
||||
const results = await this.crawlInfoRepository.query(query);
|
||||
|
||||
return results.map((item: any) => ({
|
||||
source: item.source,
|
||||
|
||||
Reference in New Issue
Block a user