This commit is contained in:
zhu
2026-04-30 10:55:03 +08:00
commit 48ce6a8b0b
27 changed files with 2970 additions and 0 deletions

130
src/config/platforms.ts Normal file
View File

@@ -0,0 +1,130 @@
import type { PlatformConfig } from '@/types';
export const PLATFORM_CONFIGS: PlatformConfig[] = [
{
id: 'Shopee',
name: 'Shopee 后台',
baseUrl: 'https://seller.shopee.com.my/',
steps: [
{
name: '数据看板',
uniqueKey: 'databoard',
url: 'https://seller.shopee.com.my/',
checkSelector: '.rate-manager-content',
fields: [
{
label: "出货统计",
className: ".status .custom-row",
keys: [
{
label: "待处理出货",
className: ".custom-col-5:nth-child(1) .item-title"
},
{
label: "已处理出货",
className: ".custom-col-5:nth-child(2) .item-title"
},
{
label: "退货/退款/取消",
className: ".custom-col-5:nth-child(3) .item-title"
},
{
label: "已禁止/压制商品",
className: ".custom-col-5:nth-child(4) .item-title"
},
]
},
{
label: "商业分析",
className: ".data-dashboard-async-data-wrapper .custom-row",
keys: [
{
label: "销售",
className: ".custom-col-5:nth-child(1) ",
keys: [
{ label: "value", className: ".dashboard-item-value" },
{ label: "change", className: ".dashboard-item-rate-number" }
]
},
{
label: "访客数",
className: ".custom-col-5:nth-child(2) ",
keys: [
{ label: "value", className: ".dashboard-item-value" },
{ label: "change", className: ".dashboard-item-rate-number" }
]
},
{
label: "Product Clicks",
className: ".custom-col-5:nth-child(3)",
keys: [
{ label: "value", className: ".dashboard-item-value" },
{ label: "change", className: ".dashboard-item-rate-number" }
]
},
{
label: "订单",
className: ".custom-col-5:nth-child(4)",
keys: [
{ label: "value", className: ".dashboard-item-value" },
{ label: "change", className: ".dashboard-item-rate-number" }
]
},
{
label: "Order Conversion Rate",
className: ".custom-col-5:nth-child(5)",
keys: [
{ label: "value", className: ".dashboard-item-value" },
{ label: "change", className: ".dashboard-item-rate-number" }
]
},
]
},
{
label: "Shopee广告",
className: ".ads-data-container",
keys: [
{
label: "广告余额",
className: ".ads-data-cell:nth-of-type(1) ",
keys: [
{ label: "value", className: ".ads-data-report-number" },
]
},
{
label: "销售额",
className: ".ads-data-cell:nth-child(3) ",
keys: [
{ label: "value", className: ".ads-data-report-number" },
{ label: "change", className: ".ratio " }
]
},
{
label: "花费",
className: ".ads-data-cell:nth-child(4)",
keys: [
{ label: "value", className: ".ads-data-report-number" },
{ label: "change", className: ".ratio " }
]
},
{
label: "广告支出回报率",
className: ".ads-data-cell:nth-child(5)",
keys: [
{ label: "value", className: ".ads-data-report-number" },
{ label: "change", className: ".ratio " }
]
},
]
},
],
},
],
},
]
/** 根据平台 ID 返回对应的平台抓取配置。 */
export function getPlatformById(platformId: string) {
return PLATFORM_CONFIGS.find((item) => item.id === platformId) ?? null;
}