Compare commits
No commits in common. "3a72d6396c580b31f18e8a7c4f6f332112c732a6" and "d8d49f7e88f6fe5a096ff84374e973a4d43b7775" have entirely different histories.
3a72d6396c
...
d8d49f7e88
@ -5,7 +5,6 @@ import { execSync } from 'child_process'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
import { inferCategory } from '../lead/lead.service'
|
||||
|
||||
const SCRIPTS_DIR = path.resolve(__dirname, '../../../../../scripts')
|
||||
const TENDER_FETCHER_DIR = path.join(SCRIPTS_DIR, 'tender-fetcher')
|
||||
@ -131,7 +130,6 @@ export class CrawlerService implements OnModuleInit {
|
||||
deadline: r.deadline,
|
||||
detailUrl: r.detailUrl,
|
||||
publishTime: r.publishTime || null,
|
||||
category: inferCategory(r.title),
|
||||
...(r.amount ? { amount: r.amount } : {}),
|
||||
...(r.region ? { region: r.region } : {}),
|
||||
...(r.regionDetail ? { regionDetail: r.regionDetail } : {}),
|
||||
@ -148,7 +146,7 @@ export class CrawlerService implements OnModuleInit {
|
||||
amount: r.amount || '待确认',
|
||||
status: '待复核',
|
||||
level: 'C',
|
||||
category: inferCategory(r.title),
|
||||
category: '',
|
||||
region: r.region || '',
|
||||
regionDetail: r.regionDetail || '',
|
||||
summary: `来源: ${r.source}\n公告ID: ${r.noticeId}\n链接: ${r.detailUrl}`,
|
||||
|
||||
@ -2,8 +2,8 @@ import { Injectable, NotFoundException, Logger, ServiceUnavailableException } fr
|
||||
import { PrismaService } from '../prisma/prisma.service'
|
||||
import { IntegrationService } from '../integration/integration.service'
|
||||
|
||||
// 品类 → 标题关键词映射(筛选 + 入库均使用)
|
||||
export const CATEGORY_KEYWORDS: Record<string, string[]> = {
|
||||
// 品类 → 标题关键词映射(筛选时按标题模糊匹配,不走 category 字段)
|
||||
const CATEGORY_KEYWORDS: Record<string, string[]> = {
|
||||
'防火门': ['防火门', '防火卷帘', '防火窗', '钢质防火', '木质防火'],
|
||||
'配电箱': ['配电箱', '配电柜', '配电盘', '照明配电箱', '动力配电箱', '电表箱'],
|
||||
'电线电缆': ['电线', '电缆', '导线', '电力线', '控制电缆', '光缆', '架空线'],
|
||||
@ -21,17 +21,6 @@ export const CATEGORY_KEYWORDS: Record<string, string[]> = {
|
||||
'电机': ['电机', '电动机', '减速机', '减速器', '变频电机'],
|
||||
}
|
||||
|
||||
/** 根据标题推断品类,未匹配返回空字符串 */
|
||||
export function inferCategory(title: string): string {
|
||||
if (!title) return ''
|
||||
for (const [cat, keywords] of Object.entries(CATEGORY_KEYWORDS)) {
|
||||
for (const kw of keywords) {
|
||||
if (title.includes(kw)) return cat
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class LeadService {
|
||||
private readonly logger = new Logger(LeadService.name)
|
||||
|
||||
@ -67,10 +67,7 @@ export default function ImagePage() {
|
||||
useEffect(() => {
|
||||
fetch(API)
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
setImages(Array.isArray(data) ? data : [])
|
||||
})
|
||||
.catch(() => setImages([]))
|
||||
.then(setImages)
|
||||
.finally(() => setLoading(false))
|
||||
}, [])
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
export const API_BASE: string = process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:4000'
|
||||
export const API_BASE: string = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4000'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user