修复分类名称映射

This commit is contained in:
甲辰生产 2026-04-11 21:11:19 +08:00
parent 926c12c787
commit dced540eb8
1 changed files with 10 additions and 3 deletions

View File

@ -487,7 +487,14 @@ export default function News() {
{activeTab === 'deal' && (() => { {activeTab === 'deal' && (() => {
const versions = ['龙钞', '马钞', '蛇钞', '其他'] const versions = ['龙钞', '马钞', '蛇钞', '其他']
const packagings = ['标百', '标十', '单张'] const packagings = ['标百', '标十', '单张']
const categories = ['带4号', '带7号', '永恒号', '钻石号', '如意号', '朦胧号', '天马号', '金山号', '金马号'] const categories = ['带4号', '带7号', '永恒号', '永恒', '钻石号', '钻石', '如意号', '朦胧号', '朦胧王', '天马号', '金山号', '金马号', '天马王', '金山王', '金马王', '倒置号', '圆圆号', '通货', '无4']
//
const normalizeCat = (c) => {
if (c === '通货') return '带4号'
if (c === '无4') return '带7号'
return c
}
const filteredData = infoList.filter(item => { const filteredData = infoList.filter(item => {
const serial = (item.title || '').split('-')[0] || '' const serial = (item.title || '').split('-')[0] || ''
@ -502,9 +509,9 @@ export default function News() {
const calcAvg = (pkg, cat) => { const calcAvg = (pkg, cat) => {
const items = filteredData.filter(item => { const items = filteredData.filter(item => {
const content = item.content || '' const content = item.content || ''
//
const p = content.includes('包装:') ? content.split('包装:')[1].split('\n')[0].trim() : (item.packaging || '') const p = content.includes('包装:') ? content.split('包装:')[1].split('\n')[0].trim() : (item.packaging || '')
const c = content.includes('分类:') ? content.split('分类:')[1].split('\n')[0].trim() : (item.category || '') let c = content.includes('分类:') ? content.split('分类:')[1].split('\n')[0].trim() : (item.category || '')
c = normalizeCat(c)
return p === pkg && c === cat return p === pkg && c === cat
}) })
if (items.length === 0) return null if (items.length === 0) return null