feat(edit): 采集插件、编辑页SKU 属性动态展示、颜色展示开发

This commit is contained in:
R524809
2026-09-22 10:11:57 +08:00
parent 05747d6f22
commit 2b06ef0692
12 changed files with 390 additions and 11 deletions
+4 -6
View File
@@ -1,5 +1,6 @@
import type { CollectedProductPayload } from '@atlas/contracts';
import { dedupeImageUrl, normaliseImageUrl } from './product-media.js';
import { formatCollectedDescription } from './description-format.js';
export type OzonPageJsonRequest = {
kind: 'modal-aspects' | 'product' | 'product-detail';
@@ -341,7 +342,7 @@ export async function collectOzonProduct(
itemKey: currentSku,
canonicalUrl: canonical,
collectedAt: new Date().toISOString(),
parserVersion: 'ozon-public-2.3.0',
parserVersion: 'ozon-public-2.3.1',
},
common: {
...(title
@@ -650,10 +651,7 @@ export function extractOzonDescription(
} catch {
// Some older page responses already contain plain text here.
}
value = value
.replace(/\s+\n/g, '\n')
.replace(/\n{3,}/g, '\n\n')
.trim();
value = formatCollectedDescription(value);
if (!value) continue;
return {
value: value.slice(0, 100_000),
@@ -678,7 +676,7 @@ export function extractOzonJsonLdDescription(
: '';
if (!raw) continue;
return {
value: raw.replace(/\s+\n/g, '\n').replace(/\n{3,}/g, '\n\n').slice(0, 100_000),
value: formatCollectedDescription(raw).slice(0, 100_000),
rawValue: raw.slice(0, 120_000),
};
} catch {