mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 12:29:19 +08:00
refacor: 重构目录架构
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import type { PlatformAdapter } from '@/platform/core/PlatformAdapter';
|
||||
import type { AdvertisingCostBatch, PageContext } from '@/types/advertisingCost';
|
||||
|
||||
/**
|
||||
* 第一阶段 Mock Adapter:不读真实 DOM,返回带日期的样例。
|
||||
* 真实页面解析等接入平台后再实现。
|
||||
*/
|
||||
export class MockPlatformAdapter implements PlatformAdapter {
|
||||
readonly platform = 'mock' as const;
|
||||
|
||||
canHandle(_url: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
async getPageContext(): Promise<PageContext> {
|
||||
return {
|
||||
url: typeof location !== 'undefined' ? location.href : '',
|
||||
title: typeof document !== 'undefined' ? document.title : '',
|
||||
platform: 'mock',
|
||||
ready: true,
|
||||
message: '当前为 Mock Adapter(未解析真实平台页面)',
|
||||
};
|
||||
}
|
||||
|
||||
async parseAdvertisingCost(): Promise<Omit<AdvertisingCostBatch, 'channelShopId'>> {
|
||||
return {
|
||||
platform: 'mock',
|
||||
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(),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user