refactor: 优化代码结构并修复类型问题

- 移除未使用的TabPane组件
- 修复类型定义和导入方式
- 优化mock数据源的环境变量判断逻辑
- 更新文档结构并归档旧文件
- 添加新的UI组件和Memo组件
- 调整API路径和响应处理
This commit is contained in:
2026-03-23 12:41:35 +08:00
parent a037843851
commit 2b86715c09
363 changed files with 39305 additions and 40622 deletions

112
docs/SERVICES/collection.md Normal file
View File

@@ -0,0 +1,112 @@
# 采集域服务
> **入口**: [_index.md](_index.md)
---
## 服务列表
| 服务 | 文件 | 职责 |
|------|------|------|
| CollectionAdapterService | services/CollectionAdapterService.ts | 采集适配 |
| TikTokConnector | core/connectors/TikTokConnector.ts | TikTok采集 |
| TemuConnector | core/connectors/TemuConnector.ts | Temu采集 |
| ShopifyConnector | core/connectors/ShopifyConnector.ts | Shopify采集 |
---
## 核心流程
```
创建采集任务 → 选择连接器 → 执行采集 → 数据解析 → 存储入库
```
---
## CollectionAdapterService
### 方法列表
| 方法 | 说明 | 参数 | 返回 |
|------|------|------|------|
| createTask | 创建任务 | CreateRequest | CollectionTask |
| executeTask | 执行任务 | taskId | CollectionResult |
| getTaskStatus | 获取状态 | taskId | TaskStatus |
| cancelTask | 取消任务 | taskId | void |
---
## Connector接口
```typescript
interface IPlatformConnector {
platformCode: string;
capabilities: {
hasApi: boolean;
supportsPriceSync: boolean;
supportsInventorySync: boolean;
supportsOrderPull: boolean;
};
pullProducts(shopId: string): Promise<PlatformProduct[]>;
pullOrders(shopId: string): Promise<PlatformOrder[]>;
pushListing(product: Product): Promise<ListingResult>;
updatePrice(listingId: string, price: number): Promise<void>;
syncInventory(listingId: string, stock: number): Promise<void>;
}
```
---
## 已实现连接器
| 连接器 | 平台 | 能力 |
|--------|------|------|
| ShopifyConnector | Shopify | API全功能 |
| AmazonConnector | Amazon | API全功能 |
| TikTokConnector | TikTok Shop | API+采集 |
| TemuConnector | Temu | 采集 |
| ShopeeConnector | Shopee | API+采集 |
---
## 待实现连接器
| 连接器 | 平台 | 优先级 |
|--------|------|--------|
| Alibaba1688Connector | 1688 | P0 |
| TikTokAdsConnector | TikTok Ads | P0 |
| FacebookAdsConnector | Facebook Ads | P0 |
| GoogleAdsConnector | Google Ads | P0 |
---
## 状态机
```
PENDING → RUNNING → COMPLETED
FAILED
```
| 状态 | 说明 |
|------|------|
| PENDING | 待执行 |
| RUNNING | 执行中 |
| COMPLETED | 已完成 |
| FAILED | 失败 |
---
## API端点
| 端点 | 方法 | 服务方法 |
|------|------|----------|
| /api/v1/collection/tasks | POST | CollectionAdapterService.createTask |
| /api/v1/collection/tasks/:id | GET | CollectionAdapterService.getTaskStatus |
| /api/v1/collection/tasks/:id/execute | POST | CollectionAdapterService.executeTask |
| /api/v1/collection/tasks/:id/cancel | POST | CollectionAdapterService.cancelTask |
---
*最后更新: 2026-03-22*