gangvy 7 saat önce
ebeveyn
işleme
f86785ed20
2 değiştirilmiş dosya ile 101 ekleme ve 7 silme
  1. 1 1
      api/routes.ts
  2. 100 6
      docs/api/sorftime/frontend_guide.md

+ 1 - 1
api/routes.ts

@@ -46,7 +46,7 @@ try {
 }
 
 router.use('/sorftime', createSorftimeRouter({
-  token: 'BasicAuth nlbuzstvrkwyadzyee5kwfrtqkc4zz09',
+  token: 'BasicAuth dllfb0npquu1rgqwcw9yb0uynndwzz09',
 }));
 
 let createTikHubRoutes;

+ 100 - 6
docs/api/sorftime/frontend_guide.md

@@ -137,6 +137,14 @@ fetch('https://partyvoc.com/api/sorftime/forward', {
 
 ### 5. 关键词查询(KeywordQuery)
 
+消耗 Request: 5
+
+参数说明:
+- **Pattern**: String - 查询模式,支持数据筛选,KeywordQueryPatternObject
+- **RankCondition**: Array - ABA排名范围,如 [1, 1000]
+- **PageIndex**: Integer - 页码索引,默认第1页
+- **PageSize**: Integer - 每页条数,最小20,默认20,最大200
+
 ```javascript
 fetch('https://partyvoc.com/api/sorftime/forward', {
   method: 'POST',
@@ -146,7 +154,10 @@ fetch('https://partyvoc.com/api/sorftime/forward', {
     method: "POST",
     query: { domain: 1 },
     body: {
-      keyword: "phone case"
+      Pattern: "phone case",
+      RankCondition: [1, 1000],
+      PageIndex: 1,
+      PageSize: 20
     }
   })
 })
@@ -155,7 +166,90 @@ fetch('https://partyvoc.com/api/sorftime/forward', {
 .catch(err => console.error(err));
 ```
 
-### 6. ASIN 关键词排名(ASINKeywordRanking)
+### 6. 图搜相似商品(SimilarProductRealtimeRequest)
+
+消耗 Request: 0(异步三步流程)
+
+通过产品图片搜索相似商品,异步流程:请求 → 查状态 → 获取结果
+
+**步骤1:发起请求**
+
+参数说明:
+- **Image**: String - 产品图片的 Base64 编码,图片大小不超过 1MB
+
+```javascript
+// 步骤1: 发起相似商品搜索请求(需要产品图片 Base64)
+const imageBase64 = '...'; // 产品图片 Base64 编码
+fetch('https://partyvoc.com/api/sorftime/forward', {
+  method: 'POST',
+  headers: { 'Content-Type': 'application/json' },
+  body: JSON.stringify({
+    path: "/api/SimilarProductRealtimeRequest",
+    method: "POST",
+    query: { domain: 1 },
+    body: {
+      Image: imageBase64
+    }
+  })
+})
+.then(res => res.json())
+.then(data => {
+  // data.Data 中包含 TaskId,用于后续查询
+  console.log('TaskId:', data);
+})
+.catch(err => console.error(err));
+```
+
+**步骤2:查询任务状态**
+
+```javascript
+// 步骤2: 查询任务状态
+fetch('https://partyvoc.com/api/sorftime/forward', {
+  method: 'POST',
+  headers: { 'Content-Type': 'application/json' },
+  body: JSON.stringify({
+    path: "/api/SimilarProductRealtimeRequestStatusQuery",
+    method: "POST",
+    query: { domain: 1 },
+    body: {
+      TaskId: 12345  // 从步骤1返回的 TaskId
+    }
+  })
+})
+.then(res => res.json())
+.then(data => console.log('Status:', data))
+.catch(err => console.error(err));
+```
+
+**步骤3:获取结果**
+
+参数说明:
+- **TaskId**: Integer - 从步骤1返回的任务ID
+
+```javascript
+// 步骤3: 获取相似商品结果
+fetch('https://partyvoc.com/api/sorftime/forward', {
+  method: 'POST',
+  headers: { 'Content-Type': 'application/json' },
+  body: JSON.stringify({
+    path: "/api/SimilarProductRealtimeRequestCollection",
+    method: "POST",
+    query: { domain: 1 },
+    body: {
+      TaskId: 12345  // 从步骤1返回的 TaskId
+    }
+  })
+})
+.then(res => res.json())
+.then(data => {
+  // data.Data 为相似商品数组,每项包含:
+  // asin, brand, title, category, price, listPrice 等
+  console.log('Similar Products:', data);
+})
+.catch(err => console.error(err));
+```
+
+### 7. ASIN 关键词排名(ASINKeywordRanking)
 
 ```javascript
 fetch('https://partyvoc.com/api/sorftime/forward', {
@@ -198,15 +292,15 @@ fetch('https://partyvoc.com/api/sorftime/forward', {
 | `/api/ProductReviewsCollection` | 商品评论采集 | `collectProductReviews` |
 | `/api/ProductReviewsCollectionStatusQuery` | 评论采集状态查询 | - |
 | `/api/ProductReviewsQuery` | 商品评论查询 | - |
-| `/api/SimilarProductRealtimeRequest` | 相似商品实时请求 | - |
-| `/api/SimilarProductRealtimeRequestStatusQuery` | 相似商品请求状态 | - |
-| `/api/SimilarProductRealtimeRequestCollection` | 相似商品采集 | - |
+| `/api/SimilarProductRealtimeRequest` | 相似商品实时请求(需 Image Base64) | - |
+| `/api/SimilarProductRealtimeRequestStatusQuery` | 相似商品请求状态(需 TaskId) | - |
+| `/api/SimilarProductRealtimeRequestCollection` | 相似商品结果采集(需 TaskId) | - |
 
 ### 关键词相关
 
 | path | 说明 |
 |------|------|
-| `/api/KeywordQuery` | 关键词查询 |
+| `/api/KeywordQuery` | 关键词查询(需 Pattern/RankCondition/PageIndex/PageSize) |
 | `/api/KeywordSearchResults` | 关键词搜索结果 |
 | `/api/KeywordRequest` | 关键词请求 |
 | `/api/KeywordSearchResultTrend` | 关键词搜索趋势 |