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
+5 -7
View File
@@ -188,6 +188,8 @@ interface PlatformAdapter {
```ts
/** 单条商品广告费(插件内统一模型) */
interface AdvertisingCostItem {
/** 统计日期 YYYY-MM-DD(每条各自一份,来自页面数据) */
feeDate: string;
/** 平台商品 ID,如拼多多 goods_id */
goodsId: string;
/** 广告费金额(元) */
@@ -199,12 +201,11 @@ interface AdvertisingCostItem {
/**
* 一次读取/同步的批次(插件内)
* channelShopId:BI 侧渠道店铺主键;拼多多 = channel_pdd_shop.id(不是 mallId)
* feeDate:以 Popup 用户选择的同步日期为准(YYYY-MM-DD)
* 日期在 items[].feeDate,由 Adapter 从页面解析,不用用户手选
*/
interface AdvertisingCostBatch {
platform: 'pdd' | 'taobao' | 'jd' | 'mock';
channelShopId: number;
feeDate: string;
items: AdvertisingCostItem[];
source: 'browser-extension';
importedAt: string; // ISO 时间,仅插件侧审计用,不必提交后端
@@ -263,7 +264,7 @@ interface BatchImportPddGoodsAdFeeRequest {
AdvertisingCostBatch
→ items[] = batch.items.map(i => ({
channelShopId: batch.channelShopId,
feeDate: batch.feeDate, // 整批同一天
feeDate: i.feeDate, // 每条各自日期
goodsId: i.goodsId,
feeAmount: i.feeAmount,
}))
@@ -450,7 +451,7 @@ BI 渠道店铺:测试店铺(channelShopId=1)
调用 Open API:`POST .../channel/pdd/goods/adfee/batch-import`(开发环境可用 Mock Client 或真实 Key)。
日期约定:**以 Popup 所选「同步日期」为准**写入每条 `feeDate`;页面解析出的日期仅作校验/提示,不一致时提示用户确认后再同步。
日期约定:**每条推广数据自带 `feeDate`**(由 Adapter 从页面解析);悬浮层 / Popup **不提供手选同步日期**。
---
@@ -467,9 +468,6 @@ type ExtensionMessage =
}
| {
type: 'PARSE_ADVERTISING_COST';
payload: {
feeDate: string; // YYYY-MM-DD,与 Popup 同步日期一致
};
}
| {
type: 'SYNC_ADVERTISING_COST';