feat: 完成多日读取支持

This commit is contained in:
2026-08-16 17:28:53 +08:00
parent f209d93733
commit c35c985eb0
22 changed files with 1263 additions and 246 deletions
@@ -2,13 +2,13 @@ import type { PlatformAdapter } from '@/platform/core/PlatformAdapter';
import type { AdvertisingCostBatch, PageContext } from '@/types/advertisingCost';
/**
* 第一阶段 Mock Adapter:不读真实 DOM,返回固定样例数据。
* 第一阶段 Mock Adapter:不读真实 DOM,返回带日期的样例。
* 真实页面解析等接入平台后再实现。
*/
export class MockPlatformAdapter implements PlatformAdapter {
readonly platform = 'mock' as const;
canHandle(_url: string): boolean {
// 未接入真实平台前,任意页面均可由 Mock 处理
return true;
}
@@ -22,19 +22,14 @@ export class MockPlatformAdapter implements PlatformAdapter {
};
}
async parseAdvertisingCost(
feeDate: string,
): Promise<Omit<AdvertisingCostBatch, 'channelShopId'>> {
const items = [
{ goodsId: 'mock-goods-1001', feeAmount: 128.5 },
{ goodsId: 'mock-goods-1002', feeAmount: 56.0 },
{ goodsId: 'mock-goods-1003', feeAmount: 1050.06 },
];
async parseAdvertisingCost(): Promise<Omit<AdvertisingCostBatch, 'channelShopId'>> {
return {
platform: 'mock',
feeDate,
items,
items: [
{ feeDate: '2026-08-14', goodsId: 'mock-goods-1001', feeAmount: 128.5 },
{ feeDate: '2026-08-15', goodsId: 'mock-goods-1002', feeAmount: 56.0 },
{ feeDate: '2026-08-16', goodsId: 'mock-goods-1003', feeAmount: 1050.06 },
],
source: 'browser-extension',
importedAt: new Date().toISOString(),
};