@gt6/sdk 1.0.37 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gt6-sdk.cjs.js +38 -2
- package/dist/gt6-sdk.cjs.js.map +1 -1
- package/dist/gt6-sdk.esm.js +38 -2
- package/dist/gt6-sdk.esm.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/modules/articles.d.ts +9 -0
- package/dist/modules/articles.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/gt6-sdk.cjs.js
CHANGED
|
@@ -662,6 +662,39 @@ class ArticlesAPI {
|
|
|
662
662
|
limit
|
|
663
663
|
};
|
|
664
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* 1.2.1 根据平台ID获取文章列表(平台用户都可以使用)
|
|
667
|
+
*/
|
|
668
|
+
async getArticlesByplatform_all(platformId, options) {
|
|
669
|
+
// 从大型分类静态文件获取该分类的文章ID列表
|
|
670
|
+
const categoryData = await this.client.request(`/platform-advertise/platform-${platformId}.json`);
|
|
671
|
+
if (!categoryData || !categoryData.articleIds || categoryData.articleIds.length === 0) {
|
|
672
|
+
return {
|
|
673
|
+
articles: [],
|
|
674
|
+
total: 0,
|
|
675
|
+
page: options?.page || 1,
|
|
676
|
+
limit: options?.limit || 10
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
// 应用分页
|
|
680
|
+
const page = options?.page || 1;
|
|
681
|
+
const limit = options?.limit || 10;
|
|
682
|
+
const offset = (page - 1) * limit;
|
|
683
|
+
const paginatedArticleIds = categoryData.articleIds.slice(offset, offset + limit);
|
|
684
|
+
// 获取文章详情
|
|
685
|
+
const articles = await Promise.all(paginatedArticleIds.map(articleId => this.getArticle_all(articleId)));
|
|
686
|
+
// 应用状态过滤
|
|
687
|
+
let filteredArticles = articles;
|
|
688
|
+
if (options?.status) {
|
|
689
|
+
filteredArticles = articles.filter(article => article.status === options.status);
|
|
690
|
+
}
|
|
691
|
+
return {
|
|
692
|
+
articles: filteredArticles,
|
|
693
|
+
total: categoryData.articleIds.length,
|
|
694
|
+
page,
|
|
695
|
+
limit
|
|
696
|
+
};
|
|
697
|
+
}
|
|
665
698
|
/**
|
|
666
699
|
* 1.3 获取文章分类列表(平台用户都可以使用)
|
|
667
700
|
*/
|
|
@@ -3081,6 +3114,9 @@ class GT6SDK {
|
|
|
3081
3114
|
async getArticlesByCategory_all(categoryId, options) {
|
|
3082
3115
|
return this.articles.getArticlesByCategory_all(categoryId, options);
|
|
3083
3116
|
}
|
|
3117
|
+
async getArticlesByplatform_all(platformId, options) {
|
|
3118
|
+
return this.articles.getArticlesByplatform_all(platformId, options);
|
|
3119
|
+
}
|
|
3084
3120
|
/**
|
|
3085
3121
|
* 4.2. 便捷方法:获取文章分类列表
|
|
3086
3122
|
*/
|
|
@@ -3180,8 +3216,8 @@ class GT6SDK {
|
|
|
3180
3216
|
/**
|
|
3181
3217
|
* 8.1.2. 便捷方法:获取父平台产品分类列表
|
|
3182
3218
|
*/
|
|
3183
|
-
async getProductsCategories_all(
|
|
3184
|
-
return this.products.getProductsCategories_all(
|
|
3219
|
+
async getProductsCategories_all(productRootCategoryId) {
|
|
3220
|
+
return this.products.getProductsCategories_all(productRootCategoryId);
|
|
3185
3221
|
}
|
|
3186
3222
|
/**
|
|
3187
3223
|
* 8.1.3. 便捷方法:根据大分类ID获取平台产品列表
|