feat: 新增浏览器插件

This commit is contained in:
2026-08-16 16:45:24 +08:00
parent 2f32d955eb
commit f209d93733
38 changed files with 4727 additions and 0 deletions
@@ -0,0 +1,55 @@
import type { AdvertisingCostBatch } from '@/types/advertisingCost';
import { openApiRequest } from '@/api/client';
import { OPEN_API_PATHS } from '@/shared/constants';
export interface BatchImportPddGoodsAdFeeItem {
channelShopId: number;
feeDate: string;
goodsId: string;
feeAmount: number;
}
export interface BatchImportPddGoodsAdFeeRequest {
items: BatchImportPddGoodsAdFeeItem[];
}
export interface BatchImportPddGoodsAdFeeResult {
totalCount: number;
successCount: number;
failureCount: number;
successIds?: number[];
failureRecords?: Array<{
rowNumber?: number;
channelShopId?: number;
goodsId?: string;
failureReason?: string;
}>;
}
/** 插件统一模型 → 后端 batch-import 入参 */
export function toBatchImportRequest(
batch: AdvertisingCostBatch,
): BatchImportPddGoodsAdFeeRequest {
return {
items: batch.items.map((item) => ({
channelShopId: batch.channelShopId,
feeDate: batch.feeDate,
goodsId: item.goodsId,
feeAmount: item.feeAmount,
})),
};
}
export async function batchImportPddGoodsAdFee(
batch: AdvertisingCostBatch,
): Promise<BatchImportPddGoodsAdFeeResult> {
const body = toBatchImportRequest(batch);
return openApiRequest<BatchImportPddGoodsAdFeeResult>(
OPEN_API_PATHS.pddGoodsAdFeeBatchImport,
{
method: 'POST',
body: JSON.stringify(body),
},
);
}