@gt6/sdk 1.0.4 → 1.0.5

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.
@@ -307,14 +307,308 @@ class ArticlesAPI {
307
307
  }
308
308
  }
309
309
 
310
+ class ProductsAPI {
311
+ constructor(client) {
312
+ this.client = client;
313
+ }
314
+ /**
315
+ * 1. 根据产品ID获取产品详情
316
+ */
317
+ async getProduct(productId) {
318
+ const product = await this.client.request(`/products/${productId}.json`);
319
+ // 检查产品是否有销售区域和税费模板
320
+ if (product.regions && product.regions.length > 0 &&
321
+ product.taxTemplates && product.taxTemplates.length > 0) {
322
+ try {
323
+ // 获取税费信息
324
+ const taxInfo = await this.getTaxInfo();
325
+ // 为每个税费模板添加规则
326
+ product.taxTemplates = product.taxTemplates.map(template => {
327
+ const matchingTemplate = taxInfo.templates.find(t => t.templateId === template.templateId);
328
+ if (matchingTemplate) {
329
+ // 过滤出产品可销售区域的规则
330
+ const productRegionIds = product.regions.map(r => r.regionId);
331
+ const applicableRules = matchingTemplate.rules.filter(rule => productRegionIds.includes(rule.regionId));
332
+ return {
333
+ ...template,
334
+ rules: applicableRules
335
+ };
336
+ }
337
+ return template;
338
+ });
339
+ }
340
+ catch (error) {
341
+ // 如果获取税费信息失败,不影响产品详情返回
342
+ console.warn('Failed to fetch tax info:', error);
343
+ }
344
+ }
345
+ // 检查产品是否有销售区域和运费模板
346
+ if (product.regions && product.regions.length > 0 &&
347
+ product.shippingTemplates && product.shippingTemplates.length > 0) {
348
+ try {
349
+ // 获取运费信息
350
+ const shippingInfo = await this.getShippingInfo();
351
+ // 为每个运费模板添加规则
352
+ product.shippingTemplates = product.shippingTemplates.map(template => {
353
+ const matchingTemplate = shippingInfo.templates.find(t => t.templateId === template.templateId);
354
+ if (matchingTemplate) {
355
+ // 过滤出产品可销售区域的规则
356
+ const productRegionIds = product.regions.map(r => r.regionId);
357
+ const applicableRules = matchingTemplate.rules.filter(rule => productRegionIds.includes(rule.regionId));
358
+ return {
359
+ ...template,
360
+ rules: applicableRules
361
+ };
362
+ }
363
+ return template;
364
+ });
365
+ }
366
+ catch (error) {
367
+ // 如果获取运费信息失败,不影响产品详情返回
368
+ console.warn('Failed to fetch shipping info:', error);
369
+ }
370
+ }
371
+ return product;
372
+ }
373
+ /**
374
+ * 2. 获取产品分类列表
375
+ */
376
+ async getCategories(productRootCategoryId) {
377
+ const config = this.client.getConfig();
378
+ const categoryId = productRootCategoryId || config.productRootCategoryId || '277233';
379
+ const response = await this.client.request(`/product-categories/platform-${config.platformId}-root-${categoryId}.json`);
380
+ return response.categories;
381
+ }
382
+ /**
383
+ * 3. 获取产品标签列表
384
+ */
385
+ async getTags(productTagAlias) {
386
+ const config = this.client.getConfig();
387
+ const alias = productTagAlias || config.productTagAlias || '01';
388
+ const response = await this.client.request(`/product-tags/platform-${config.platformId}-${alias}.json`);
389
+ return response.tags;
390
+ }
391
+ /**
392
+ * 4. 根据分类ID获取产品列表
393
+ * 支持单个分类ID或分类ID数组
394
+ */
395
+ async getProductsByCategory(categoryId, options) {
396
+ // 获取分类数据
397
+ const categories = await this.getCategories();
398
+ // 将单个分类ID转换为数组
399
+ const categoryIds = Array.isArray(categoryId) ? categoryId : [categoryId];
400
+ // 收集所有指定分类下的产品ID
401
+ const allProductIds = [];
402
+ categoryIds.forEach(id => {
403
+ const targetCategory = categories.find(cat => cat.categoryId === id);
404
+ if (targetCategory) {
405
+ allProductIds.push(...targetCategory.productIds);
406
+ }
407
+ });
408
+ // 去重
409
+ const uniqueProductIds = [...new Set(allProductIds)];
410
+ if (uniqueProductIds.length === 0) {
411
+ return {
412
+ products: [],
413
+ total: 0,
414
+ page: options?.page || 1,
415
+ limit: options?.limit || 10
416
+ };
417
+ }
418
+ // 应用分页
419
+ const page = options?.page || 1;
420
+ const limit = options?.limit || 10;
421
+ const offset = (page - 1) * limit;
422
+ const paginatedProductIds = uniqueProductIds.slice(offset, offset + limit);
423
+ // 获取产品详情
424
+ const products = await Promise.all(paginatedProductIds.map(productId => this.getProduct(productId)));
425
+ // 应用状态过滤
426
+ let filteredProducts = products;
427
+ if (options?.status !== undefined) {
428
+ filteredProducts = products.filter(product => product.status === options.status);
429
+ }
430
+ return {
431
+ products: filteredProducts,
432
+ total: uniqueProductIds.length,
433
+ page,
434
+ limit
435
+ };
436
+ }
437
+ /**
438
+ * 5. 根据标签ID获取产品列表
439
+ * 支持单个标签ID或标签ID数组
440
+ */
441
+ async getProductsByTag(tagId, options) {
442
+ // 获取标签数据,传递productTagAlias参数
443
+ const tags = await this.getTags(options?.productTagAlias);
444
+ // 将单个标签ID转换为数组
445
+ const tagIds = Array.isArray(tagId) ? tagId : [tagId];
446
+ // 收集所有指定标签下的产品ID
447
+ const allProductIds = [];
448
+ tagIds.forEach(id => {
449
+ const targetTag = tags.find(tag => tag.tagId === id);
450
+ if (targetTag) {
451
+ allProductIds.push(...targetTag.productIds);
452
+ }
453
+ });
454
+ // 去重
455
+ const uniqueProductIds = [...new Set(allProductIds)];
456
+ if (uniqueProductIds.length === 0) {
457
+ return {
458
+ products: [],
459
+ total: 0,
460
+ page: options?.page || 1,
461
+ limit: options?.limit || 10
462
+ };
463
+ }
464
+ // 应用分页
465
+ const page = options?.page || 1;
466
+ const limit = options?.limit || 10;
467
+ const offset = (page - 1) * limit;
468
+ const paginatedProductIds = uniqueProductIds.slice(offset, offset + limit);
469
+ // 获取产品详情
470
+ const products = await Promise.all(paginatedProductIds.map(productId => this.getProduct(productId)));
471
+ // 应用状态过滤
472
+ let filteredProducts = products;
473
+ if (options?.status !== undefined) {
474
+ filteredProducts = products.filter(product => product.status === options.status);
475
+ }
476
+ return {
477
+ products: filteredProducts,
478
+ total: uniqueProductIds.length,
479
+ page,
480
+ limit
481
+ };
482
+ }
483
+ /**
484
+ * 6. 根据分类ID获取该分类的层级路径
485
+ * 用于前端面包屑导航
486
+ */
487
+ async getCategoryPath(categoryId) {
488
+ // 获取所有分类数据
489
+ const categories = await this.getCategories();
490
+ // 查找目标分类
491
+ const targetCategory = categories.find(cat => cat.categoryId === categoryId);
492
+ if (!targetCategory) {
493
+ return {
494
+ path: [],
495
+ currentCategory: null,
496
+ breadcrumbs: []
497
+ };
498
+ }
499
+ // 构建分类路径
500
+ const path = [];
501
+ const breadcrumbs = [];
502
+ // 递归查找父分类
503
+ const buildPath = (currentCategory, level = 0) => {
504
+ // 将当前分类添加到路径开头(因为我们要从根到叶子构建)
505
+ path.unshift(currentCategory);
506
+ breadcrumbs.unshift({
507
+ categoryId: currentCategory.categoryId,
508
+ categoryName: currentCategory.categoryName,
509
+ level
510
+ });
511
+ // 如果有父分类,继续递归
512
+ if (currentCategory.parentId && currentCategory.parentId !== 0) {
513
+ const parentCategory = categories.find(cat => cat.categoryId === currentCategory.parentId);
514
+ if (parentCategory) {
515
+ buildPath(parentCategory, level + 1);
516
+ }
517
+ }
518
+ };
519
+ // 从目标分类开始构建路径
520
+ buildPath(targetCategory);
521
+ return {
522
+ path,
523
+ currentCategory: targetCategory,
524
+ breadcrumbs
525
+ };
526
+ }
527
+ /**
528
+ * 7. 获取指定分类ID下的子分类
529
+ * 支持递归获取所有层级的子分类
530
+ */
531
+ async getSubCategories(categoryId, options) {
532
+ // 获取所有分类数据
533
+ const categories = await this.getCategories();
534
+ // 查找目标分类
535
+ const targetCategory = categories.find(cat => cat.categoryId === categoryId);
536
+ if (!targetCategory) {
537
+ return {
538
+ subCategories: [],
539
+ currentCategory: null,
540
+ total: 0,
541
+ depth: 0
542
+ };
543
+ }
544
+ const subCategories = [];
545
+ let maxDepth = options?.maxDepth || Infinity;
546
+ let actualDepth = 0;
547
+ // 递归获取子分类的函数
548
+ const collectSubCategories = (parentId, currentDepth = 0) => {
549
+ if (currentDepth >= maxDepth) {
550
+ return;
551
+ }
552
+ // 查找直接子分类
553
+ const children = categories.filter(cat => cat.parentId === parentId);
554
+ children.forEach(child => {
555
+ subCategories.push(child);
556
+ // 如果需要递归且未达到最大深度,继续查找子分类
557
+ if (options?.recursive && currentDepth < maxDepth - 1) {
558
+ collectSubCategories(child.categoryId, currentDepth + 1);
559
+ }
560
+ });
561
+ // 更新实际深度
562
+ actualDepth = Math.max(actualDepth, currentDepth);
563
+ };
564
+ // 开始收集子分类
565
+ collectSubCategories(categoryId);
566
+ // 如果需要包含当前分类,添加到结果中
567
+ if (options?.includeCurrent) {
568
+ subCategories.unshift(targetCategory);
569
+ }
570
+ return {
571
+ subCategories,
572
+ currentCategory: targetCategory,
573
+ total: subCategories.length,
574
+ depth: actualDepth
575
+ };
576
+ }
577
+ /**
578
+ * 8. 获取税费信息
579
+ * 获取平台的所有税费模板和规则
580
+ */
581
+ async getTaxInfo() {
582
+ const config = this.client.getConfig();
583
+ return this.client.request(`/tax/platform-${config.platformId}.json`);
584
+ }
585
+ /**
586
+ * 9. 获取运费信息
587
+ * 获取平台的所有运费模板和规则
588
+ */
589
+ async getShippingInfo() {
590
+ const config = this.client.getConfig();
591
+ return this.client.request(`/shipping/platform-${config.platformId}.json`);
592
+ }
593
+ /**
594
+ * 10. 获取区域信息
595
+ * 获取平台的所有区域信息,包括层级结构
596
+ */
597
+ async getRegions() {
598
+ const config = this.client.getConfig();
599
+ return this.client.request(`/regions/platform-${config.platformId}.json`);
600
+ }
601
+ }
602
+
310
603
  /**
311
604
  * GT6 SDK 主类
312
- * 提供文章管理相关的所有功能
605
+ * 提供文章和产品管理相关的所有功能
313
606
  */
314
607
  class GT6SDK {
315
608
  constructor(config) {
316
609
  const client = new GT6Client(config);
317
610
  this.articles = new ArticlesAPI(client);
611
+ this.products = new ProductsAPI(client);
318
612
  }
319
613
  /**
320
614
  * 获取客户端实例(用于高级用法)
@@ -376,7 +670,67 @@ class GT6SDK {
376
670
  async getSubCategories(categoryId, options) {
377
671
  return this.articles.getSubCategories(categoryId, options);
378
672
  }
673
+ /**
674
+ * 8. 便捷方法:根据产品ID获取产品详情
675
+ */
676
+ async getProduct(productId) {
677
+ return this.products.getProduct(productId);
678
+ }
679
+ /**
680
+ * 9. 便捷方法:获取产品分类列表
681
+ */
682
+ async getProductCategories(productRootCategoryId) {
683
+ return this.products.getCategories(productRootCategoryId);
684
+ }
685
+ /**
686
+ * 10. 便捷方法:获取产品标签列表
687
+ */
688
+ async getProductTags(productTagAlias) {
689
+ return this.products.getTags(productTagAlias);
690
+ }
691
+ /**
692
+ * 11. 便捷方法:根据分类ID获取产品列表
693
+ */
694
+ async getProductsByCategory(categoryId, options) {
695
+ return this.products.getProductsByCategory(categoryId, options);
696
+ }
697
+ /**
698
+ * 12. 便捷方法:根据标签ID获取产品列表
699
+ */
700
+ async getProductsByTag(tagId, options) {
701
+ return this.products.getProductsByTag(tagId, options);
702
+ }
703
+ /**
704
+ * 13. 便捷方法:根据分类ID获取该分类的层级路径
705
+ */
706
+ async getProductCategoryPath(categoryId) {
707
+ return this.products.getCategoryPath(categoryId);
708
+ }
709
+ /**
710
+ * 14. 便捷方法:获取指定分类ID下的子分类
711
+ */
712
+ async getProductSubCategories(categoryId, options) {
713
+ return this.products.getSubCategories(categoryId, options);
714
+ }
715
+ /**
716
+ * 15. 便捷方法:获取税费信息
717
+ */
718
+ async getTaxInfo() {
719
+ return this.products.getTaxInfo();
720
+ }
721
+ /**
722
+ * 16. 便捷方法:获取运费信息
723
+ */
724
+ async getShippingInfo() {
725
+ return this.products.getShippingInfo();
726
+ }
727
+ /**
728
+ * 17. 便捷方法:获取区域信息
729
+ */
730
+ async getRegions() {
731
+ return this.products.getRegions();
732
+ }
379
733
  }
380
734
 
381
- export { ArticlesAPI, GT6Client, GT6Error, GT6SDK, GT6SDK as default };
735
+ export { ArticlesAPI, GT6Client, GT6Error, GT6SDK, ProductsAPI, GT6SDK as default };
382
736
  //# sourceMappingURL=gt6-sdk.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gt6-sdk.esm.js","sources":["../src/core/types.ts","../src/core/client.ts","../src/modules/articles.ts","../src/index.ts"],"sourcesContent":["// 基础配置类型\nexport interface GT6Config {\n baseUrl: string;\n apiKey?: string;\n platformId: string | number;\n rootCategoryId?: string | number;\n tagAlias?: string;\n version?: string;\n timeout?: number;\n cache?: {\n enabled: boolean;\n ttl: number; // 缓存时间(毫秒)\n };\n}\n\n// 分类相关类型\nexport interface Category {\n categoryId: number;\n categoryName: string;\n categoryDescription: string;\n metaKeywords: string;\n status: number;\n parentId: number;\n sortOrder: number;\n createdAt: any;\n updatedAt: any;\n platformId: number;\n articleIds: number[];\n children: Category[];\n}\n\nexport interface CategoryResponse {\n platformId: number;\n categories: Category[];\n generatedAt: string;\n}\n\n// 标签相关类型\nexport interface Tag {\n tagId: number;\n tagName: string;\n type: number;\n platformId: number;\n aliases: string;\n createdAt: any;\n articleIds: number[];\n}\n\nexport interface TagResponse {\n platformId: number;\n tags: Tag[];\n generatedAt: string;\n}\n\n// 文章元数据类型\nexport interface ArticleMetaData {\n metaId: number;\n articleId: number;\n metaKey: string;\n metaValue: string;\n type: number;\n templateId: number;\n groupId: number;\n sortOrder: number;\n aiId: number;\n fieldId: number;\n createdAt: any;\n updatedAt: any;\n}\n\n// 文章图片类型\nexport interface ArticleImage {\n imageId: number;\n articleId: number;\n metaId: number | null;\n imageUrl: string;\n imageType: 'cover' | 'content';\n sortOrder: number;\n createdAt: any;\n updatedAt: any;\n}\n\n// 文章类型\nexport interface Article {\n articleId: number;\n title: string;\n content: string;\n status: 'published' | 'draft' | 'archived';\n publishedAt: string;\n templateId: number;\n aiId: number;\n platformId: number;\n isVisible: boolean;\n displayTemplate: string;\n createdAt: any;\n updatedAt: any;\n categories: Category[];\n tags: Tag[];\n metaData: ArticleMetaData[];\n images: ArticleImage[];\n generatedAt: string;\n}\n\n// 文章列表项类型(简化版)\nexport interface ArticleListItem {\n articleId: number;\n title: string;\n status: string;\n publishedAt: string;\n categories: Category[];\n tags: Tag[];\n coverImage?: string;\n}\n\n// 错误类型\nexport class GT6Error extends Error {\n constructor(\n message: string,\n public statusCode?: number\n ) {\n super(message);\n this.name = 'GT6Error';\n }\n}\n\n// 查询参数类型\nexport interface ArticleQueryParams {\n categoryId?: number;\n tagId?: number;\n status?: string;\n limit?: number;\n offset?: number;\n sortBy?: 'publishedAt' | 'title' | 'sortOrder';\n sortOrder?: 'asc' | 'desc';\n}\n\n// 根据标签获取文章的选项类型\nexport interface ArticlesByTagOptions {\n page?: number;\n limit?: number;\n status?: 'published' | 'draft' | 'archived';\n tagAlias?: string;\n}\n\n// 根据分类获取文章的选项类型\nexport interface ArticlesByCategoryOptions {\n page?: number;\n limit?: number;\n status?: 'published' | 'draft' | 'archived';\n}\n\n// 文章统计类型\nexport interface ArticleStats {\n total: number;\n published: number;\n draft: number;\n archived: number;\n byCategory: Record<number, number>;\n byTag: Record<number, number>;\n}\n\nexport interface GT6Response<T> {\n success: boolean;\n data: T;\n error?: string;\n}\n\nexport interface ArticleResponse {\n article: Article;\n}\n\nexport interface CategoryResponse {\n categories: Category[];\n}\n\nexport interface TagResponse {\n tags: Tag[];\n} ","import { GT6Config, GT6Error } from './types';\r\n\r\nexport class GT6Client {\r\n private config: GT6Config;\r\n private cache: Map<string, { data: any; timestamp: number }>;\r\n\r\n constructor(config: GT6Config) {\r\n this.config = {\r\n timeout: 10000,\r\n cache: {\r\n enabled: true,\r\n ttl: 300000 // 5分钟默认缓存\r\n },\r\n ...config\r\n };\r\n this.cache = new Map();\r\n }\r\n\r\n /**\r\n * 发起HTTP请求\r\n */\r\n async request<T>(endpoint: string, options: RequestInit = {}): Promise<T> {\r\n const url = `${this.config.baseUrl}${endpoint}`;\r\n const cacheKey = `${options.method || 'GET'}:${url}`;\r\n\r\n // 检查缓存(只对GET请求缓存)\r\n if (this.config.cache?.enabled && options.method !== 'POST' && options.method !== 'PUT' && options.method !== 'DELETE') {\r\n const cached = this.cache.get(cacheKey);\r\n if (cached && Date.now() - cached.timestamp < this.config.cache.ttl) {\r\n return cached.data;\r\n }\r\n }\r\n\r\n try {\r\n const controller = new AbortController();\r\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\r\n\r\n const response = await fetch(url, {\r\n ...options,\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n ...options.headers,\r\n },\r\n signal: controller.signal\r\n });\r\n\r\n clearTimeout(timeoutId);\r\n\r\n if (!response.ok) {\r\n throw new GT6Error(\r\n `HTTP ${response.status}: ${response.statusText}`,\r\n response.status\r\n );\r\n }\r\n\r\n const data = await response.json();\r\n\r\n // 更新缓存(只对GET请求缓存)\r\n if (this.config.cache?.enabled && options.method !== 'POST' && options.method !== 'PUT' && options.method !== 'DELETE') {\r\n this.cache.set(cacheKey, { data, timestamp: Date.now() });\r\n }\r\n\r\n return data;\r\n } catch (error: any) {\r\n if (error instanceof GT6Error) {\r\n throw error;\r\n }\r\n \r\n if (error.name === 'AbortError') {\r\n throw new GT6Error('Request timeout', 408);\r\n }\r\n \r\n throw new GT6Error(`Network error: ${error.message}`);\r\n }\r\n }\r\n\r\n /**\r\n * 获取配置\r\n */\r\n getConfig(): GT6Config {\r\n return { ...this.config };\r\n }\r\n\r\n /**\r\n * 清除缓存\r\n */\r\n clearCache(): void {\r\n this.cache.clear();\r\n }\r\n\r\n /**\r\n * 获取缓存统计\r\n */\r\n getCacheStats(): { size: number; entries: Array<{ key: string; age: number }> } {\r\n const entries = Array.from(this.cache.entries()).map(([key, value]) => ({\r\n key,\r\n age: Date.now() - value.timestamp\r\n }));\r\n\r\n return {\r\n size: this.cache.size,\r\n entries\r\n };\r\n }\r\n} ","import { GT6Client } from '../core/client';\r\nimport {\r\n Article,\r\n Category,\r\n Tag,\r\n CategoryResponse,\r\n TagResponse,\r\n ArticlesByTagOptions,\r\n ArticlesByCategoryOptions\r\n} from '../core/types';\r\n\r\nexport class ArticlesAPI {\r\n constructor(private client: GT6Client) {}\r\n\r\n /**\r\n * 1. 根据文章ID获取文章详情\r\n */\r\n async getArticle(articleId: number | string): Promise<Article> {\r\n return this.client.request<Article>(`/articles/${articleId}.json`);\r\n }\r\n\r\n /**\r\n * 2. 获取文章分类列表\r\n */\r\n async getCategories(rootCategoryId?: number | string): Promise<Category[]> {\r\n const config = this.client.getConfig();\r\n const categoryId = rootCategoryId || config.rootCategoryId || '671920';\r\n \r\n const response = await this.client.request<CategoryResponse>(\r\n `/article-categories/platform-${config.platformId}-root-${categoryId}.json`\r\n );\r\n \r\n return response.categories;\r\n }\r\n\r\n /**\r\n * 3. 获取文章标签列表\r\n */\r\n async getTags(tagAlias?: string): Promise<Tag[]> {\r\n const config = this.client.getConfig();\r\n const alias = tagAlias || config.tagAlias || '001';\r\n \r\n const response = await this.client.request<TagResponse>(\r\n `/article-tags/platform-${config.platformId}-${alias}.json`\r\n );\r\n \r\n return response.tags;\r\n }\r\n\r\n /**\r\n * 4. 根据分类ID获取文章列表\r\n * 支持单个分类ID或分类ID数组\r\n */\r\n async getArticlesByCategory(categoryId: number | number[], options?: ArticlesByCategoryOptions): Promise<{\r\n articles: Article[];\r\n total: number;\r\n page: number;\r\n limit: number;\r\n }> {\r\n // 获取分类数据\r\n const categories = await this.getCategories();\r\n \r\n // 将单个分类ID转换为数组\r\n const categoryIds = Array.isArray(categoryId) ? categoryId : [categoryId];\r\n \r\n // 收集所有指定分类下的文章ID\r\n const allArticleIds: number[] = [];\r\n \r\n categoryIds.forEach(id => {\r\n const targetCategory = categories.find(cat => cat.categoryId === id);\r\n if (targetCategory) {\r\n allArticleIds.push(...targetCategory.articleIds);\r\n }\r\n });\r\n \r\n // 去重\r\n const uniqueArticleIds = [...new Set(allArticleIds)];\r\n \r\n if (uniqueArticleIds.length === 0) {\r\n return {\r\n articles: [],\r\n total: 0,\r\n page: options?.page || 1,\r\n limit: options?.limit || 10\r\n };\r\n }\r\n \r\n // 应用分页\r\n const page = options?.page || 1;\r\n const limit = options?.limit || 10;\r\n const offset = (page - 1) * limit;\r\n const paginatedArticleIds = uniqueArticleIds.slice(offset, offset + limit);\r\n \r\n // 获取文章详情\r\n const articles = await Promise.all(\r\n paginatedArticleIds.map(articleId => this.getArticle(articleId))\r\n );\r\n \r\n // 应用状态过滤\r\n let filteredArticles = articles;\r\n if (options?.status) {\r\n filteredArticles = articles.filter(article => article.status === options.status);\r\n }\r\n \r\n return {\r\n articles: filteredArticles,\r\n total: uniqueArticleIds.length,\r\n page,\r\n limit\r\n };\r\n }\r\n\r\n /**\r\n * 5. 根据标签ID获取文章列表\r\n * 支持单个标签ID或标签ID数组\r\n */\r\n async getArticlesByTag(tagId: number | number[], options?: ArticlesByTagOptions): Promise<{\r\n articles: Article[];\r\n total: number;\r\n page: number;\r\n limit: number;\r\n }> {\r\n // 获取标签数据,传递tagAlias参数\r\n const tags = await this.getTags(options?.tagAlias);\r\n \r\n // 将单个标签ID转换为数组\r\n const tagIds = Array.isArray(tagId) ? tagId : [tagId];\r\n \r\n // 收集所有指定标签下的文章ID\r\n const allArticleIds: number[] = [];\r\n \r\n tagIds.forEach(id => {\r\n const targetTag = tags.find(tag => tag.tagId === id);\r\n if (targetTag) {\r\n allArticleIds.push(...targetTag.articleIds);\r\n }\r\n });\r\n \r\n // 去重\r\n const uniqueArticleIds = [...new Set(allArticleIds)];\r\n \r\n if (uniqueArticleIds.length === 0) {\r\n return {\r\n articles: [],\r\n total: 0,\r\n page: options?.page || 1,\r\n limit: options?.limit || 10\r\n };\r\n }\r\n \r\n // 应用分页\r\n const page = options?.page || 1;\r\n const limit = options?.limit || 10;\r\n const offset = (page - 1) * limit;\r\n const paginatedArticleIds = uniqueArticleIds.slice(offset, offset + limit);\r\n \r\n // 获取文章详情\r\n const articles = await Promise.all(\r\n paginatedArticleIds.map(articleId => this.getArticle(articleId))\r\n );\r\n \r\n // 应用状态过滤\r\n let filteredArticles = articles;\r\n if (options?.status) {\r\n filteredArticles = articles.filter(article => article.status === options.status);\r\n }\r\n \r\n return {\r\n articles: filteredArticles,\r\n total: uniqueArticleIds.length,\r\n page,\r\n limit\r\n };\r\n }\r\n\r\n /**\r\n * 6. 根据分类ID获取该分类的层级路径\r\n * 用于前端面包屑导航\r\n */\r\n async getCategoryPath(categoryId: number): Promise<{\r\n path: Category[];\r\n currentCategory: Category | null;\r\n breadcrumbs: Array<{\r\n categoryId: number;\r\n categoryName: string;\r\n level: number;\r\n }>;\r\n }> {\r\n // 获取所有分类数据\r\n const categories = await this.getCategories();\r\n \r\n // 查找目标分类\r\n const targetCategory = categories.find(cat => cat.categoryId === categoryId);\r\n \r\n if (!targetCategory) {\r\n return {\r\n path: [],\r\n currentCategory: null,\r\n breadcrumbs: []\r\n };\r\n }\r\n \r\n // 构建分类路径\r\n const path: Category[] = [];\r\n const breadcrumbs: Array<{\r\n categoryId: number;\r\n categoryName: string;\r\n level: number;\r\n }> = [];\r\n \r\n // 递归查找父分类\r\n const buildPath = (currentCategory: Category, level: number = 0): void => {\r\n // 将当前分类添加到路径开头(因为我们要从根到叶子构建)\r\n path.unshift(currentCategory);\r\n breadcrumbs.unshift({\r\n categoryId: currentCategory.categoryId,\r\n categoryName: currentCategory.categoryName,\r\n level\r\n });\r\n \r\n // 如果有父分类,继续递归\r\n if (currentCategory.parentId && currentCategory.parentId !== 0) {\r\n const parentCategory = categories.find(cat => cat.categoryId === currentCategory.parentId);\r\n if (parentCategory) {\r\n buildPath(parentCategory, level + 1);\r\n }\r\n }\r\n };\r\n \r\n // 从目标分类开始构建路径\r\n buildPath(targetCategory);\r\n \r\n return {\r\n path,\r\n currentCategory: targetCategory,\r\n breadcrumbs\r\n };\r\n }\r\n\r\n /**\r\n * 7. 获取指定分类ID下的子分类\r\n * 支持递归获取所有层级的子分类\r\n */\r\n async getSubCategories(categoryId: number, options?: {\r\n recursive?: boolean; // 是否递归获取所有层级的子分类\r\n includeCurrent?: boolean; // 是否包含当前分类\r\n maxDepth?: number; // 最大递归深度,默认不限制\r\n }): Promise<{\r\n subCategories: Category[];\r\n currentCategory: Category | null;\r\n total: number;\r\n depth: number; // 实际递归深度\r\n }> {\r\n // 获取所有分类数据\r\n const categories = await this.getCategories();\r\n \r\n // 查找目标分类\r\n const targetCategory = categories.find(cat => cat.categoryId === categoryId);\r\n \r\n if (!targetCategory) {\r\n return {\r\n subCategories: [],\r\n currentCategory: null,\r\n total: 0,\r\n depth: 0\r\n };\r\n }\r\n \r\n const subCategories: Category[] = [];\r\n let maxDepth = options?.maxDepth || Infinity;\r\n let actualDepth = 0;\r\n \r\n // 递归获取子分类的函数\r\n const collectSubCategories = (parentId: number, currentDepth: number = 0): void => {\r\n if (currentDepth >= maxDepth) {\r\n return;\r\n }\r\n \r\n // 查找直接子分类\r\n const children = categories.filter(cat => cat.parentId === parentId);\r\n \r\n children.forEach(child => {\r\n subCategories.push(child);\r\n \r\n // 如果需要递归且未达到最大深度,继续查找子分类\r\n if (options?.recursive && currentDepth < maxDepth - 1) {\r\n collectSubCategories(child.categoryId, currentDepth + 1);\r\n }\r\n });\r\n \r\n // 更新实际深度\r\n actualDepth = Math.max(actualDepth, currentDepth);\r\n };\r\n \r\n // 开始收集子分类\r\n collectSubCategories(categoryId);\r\n \r\n // 如果需要包含当前分类,添加到结果中\r\n if (options?.includeCurrent) {\r\n subCategories.unshift(targetCategory);\r\n }\r\n \r\n return {\r\n subCategories,\r\n currentCategory: targetCategory,\r\n total: subCategories.length,\r\n depth: actualDepth\r\n };\r\n }\r\n} ","import { GT6Client } from './core/client';\r\nimport { ArticlesAPI } from './modules/articles';\r\nimport { GT6Config, ArticlesByCategoryOptions, ArticlesByTagOptions } from './core/types';\r\n\r\n/**\r\n * GT6 SDK 主类\r\n * 提供文章管理相关的所有功能\r\n */\r\nexport class GT6SDK {\r\n public articles: ArticlesAPI;\r\n\r\n constructor(config: GT6Config) {\r\n const client = new GT6Client(config);\r\n this.articles = new ArticlesAPI(client);\r\n }\r\n\r\n /**\r\n * 获取客户端实例(用于高级用法)\r\n */\r\n getClient(): GT6Client {\r\n return (this.articles as any).client;\r\n }\r\n\r\n /**\r\n * 清除所有缓存\r\n */\r\n clearCache(): void {\r\n this.getClient().clearCache();\r\n }\r\n\r\n /**\r\n * 获取缓存统计信息\r\n */\r\n getCacheStats() {\r\n return this.getClient().getCacheStats();\r\n }\r\n\r\n /**\r\n * 1. 便捷方法:根据文章ID获取文章详情\r\n */\r\n async getArticle(articleId: number | string) {\r\n return this.articles.getArticle(articleId);\r\n }\r\n\r\n /**\r\n * 2. 便捷方法:获取文章分类列表\r\n */\r\n async getCategories(rootCategoryId?: number | string) {\r\n return this.articles.getCategories(rootCategoryId);\r\n }\r\n\r\n /**\r\n * 3. 便捷方法:获取文章标签列表\r\n */\r\n async getTags(tagAlias?: string) {\r\n return this.articles.getTags(tagAlias);\r\n }\r\n\r\n /**\r\n * 4. 便捷方法:根据分类ID获取文章列表\r\n */\r\n async getArticlesByCategory(categoryId: number | number[], options?: ArticlesByCategoryOptions) {\r\n return this.articles.getArticlesByCategory(categoryId, options);\r\n }\r\n\r\n /**\r\n * 5. 便捷方法:根据标签ID获取文章列表\r\n */\r\n async getArticlesByTag(tagId: number | number[], options?: ArticlesByTagOptions) {\r\n return this.articles.getArticlesByTag(tagId, options);\r\n }\r\n\r\n /**\r\n * 6. 便捷方法:根据分类ID获取该分类的层级路径\r\n */\r\n async getCategoryPath(categoryId: number) {\r\n return this.articles.getCategoryPath(categoryId);\r\n }\r\n\r\n /**\r\n * 7. 便捷方法:获取指定分类ID下的子分类\r\n */\r\n async getSubCategories(categoryId: number, options?: {\r\n recursive?: boolean;\r\n includeCurrent?: boolean;\r\n maxDepth?: number;\r\n }) {\r\n return this.articles.getSubCategories(categoryId, options);\r\n }\r\n}\r\n\r\n// 导出所有类型\r\nexport * from './core/types';\r\nexport * from './core/client';\r\nexport * from './modules/articles';\r\n\r\n// 默认导出\r\nexport default GT6SDK; "],"names":[],"mappings":"AAkHA;AACM,MAAO,QAAS,SAAQ,KAAK,CAAA;IACjC,WAAA,CACE,OAAe,EACR,UAAmB,EAAA;QAE1B,KAAK,CAAC,OAAO,CAAC;QAFP,IAAA,CAAA,UAAU,GAAV,UAAU;AAGjB,QAAA,IAAI,CAAC,IAAI,GAAG,UAAU;;AAEzB;;MCzHY,SAAS,CAAA;AAIpB,IAAA,WAAA,CAAY,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AC,SAA0B,EAAA;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;;AAG5C;;AAEG;IACH,MAAM,aAAa,CAAC,cAAgC,EAAA;QAClD,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC;;AAGpD;;AAEG;IACH,MAAM,OAAO,CAAC,QAAiB,EAAA;QAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC;;AAGxC;;AAEG;AACH,IAAA,MAAM,qBAAqB,CAAC,UAA6B,EAAE,OAAmC,EAAA;QAC5F,OAAO,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,UAAU,EAAE,OAAO,CAAC;;AAGjE;;AAEG;AACH,IAAA,MAAM,gBAAgB,CAAC,KAAwB,EAAE,OAA8B,EAAA;QAC7E,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC;;AAGvD;;AAEG;IACH,MAAM,eAAe,CAAC,UAAkB,EAAA;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC;;AAGlD;;AAEG;AACH,IAAA,MAAM,gBAAgB,CAAC,UAAkB,EAAE,OAI1C,EAAA;QACC,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC;;AAE7D;;;;"}
1
+ {"version":3,"file":"gt6-sdk.esm.js","sources":["../src/core/types.ts","../src/core/client.ts","../src/modules/articles.ts","../src/modules/products.ts","../src/index.ts"],"sourcesContent":["// 基础配置类型\nexport interface GT6Config {\n baseUrl: string;\n apiKey?: string;\n platformId: string | number;\n rootCategoryId?: string | number;\n tagAlias?: string;\n // 产品专用配置字段\n productRootCategoryId?: string | number;\n productTagAlias?: string;\n version?: string;\n timeout?: number;\n cache?: {\n enabled: boolean;\n ttl: number; // 缓存时间(毫秒)\n };\n}\n\n// 分类相关类型\nexport interface Category {\n categoryId: number;\n categoryName: string;\n categoryDescription: string;\n metaKeywords: string;\n status: number;\n parentId: number;\n sortOrder: number;\n createdAt: any;\n updatedAt: any;\n platformId: number;\n articleIds: number[];\n children: Category[];\n}\n\nexport interface CategoryResponse {\n platformId: number;\n categories: Category[];\n generatedAt: string;\n}\n\n// 产品分类相关类型\nexport interface ProductCategory {\n categoryId: number;\n categoryName: string;\n categoryDescription: string;\n metaKeywords: string;\n status: number;\n parentId: number;\n sortOrder: number;\n createdAt: any;\n updatedAt: any;\n platformId: number;\n productIds: number[];\n children: ProductCategory[];\n}\n\nexport interface ProductCategoryResponse {\n platformId: number;\n categories: ProductCategory[];\n generatedAt: string;\n}\n\n// 标签相关类型\nexport interface Tag {\n tagId: number;\n tagName: string;\n type: number;\n platformId: number;\n aliases: string;\n createdAt: any;\n articleIds: number[];\n}\n\nexport interface TagResponse {\n platformId: number;\n tags: Tag[];\n generatedAt: string;\n}\n\n// 产品标签相关类型\nexport interface ProductTag {\n tagId: number;\n tagName: string;\n type: number;\n platformId: number;\n aliases: string;\n createdAt: any;\n productIds: number[];\n}\n\nexport interface ProductTagResponse {\n platformId: number;\n tags: ProductTag[];\n generatedAt: string;\n}\n\n// 文章元数据类型\nexport interface ArticleMetaData {\n metaId: number;\n articleId: number;\n metaKey: string;\n metaValue: string;\n type: number;\n templateId: number;\n groupId: number;\n sortOrder: number;\n aiId: number;\n fieldId: number;\n createdAt: any;\n updatedAt: any;\n}\n\n// 文章图片类型\nexport interface ArticleImage {\n imageId: number;\n articleId: number;\n metaId: number | null;\n imageUrl: string;\n imageType: 'cover' | 'content';\n sortOrder: number;\n createdAt: any;\n updatedAt: any;\n}\n\n// 文章类型\nexport interface Article {\n articleId: number;\n title: string;\n content: string;\n status: 'published' | 'draft' | 'archived';\n publishedAt: string;\n templateId: number;\n aiId: number;\n platformId: number;\n isVisible: boolean;\n displayTemplate: string;\n createdAt: any;\n updatedAt: any;\n categories: Category[];\n tags: Tag[];\n metaData: ArticleMetaData[];\n images: ArticleImage[];\n generatedAt: string;\n}\n\n// 产品详情类型\nexport interface ProductDetail {\n detailId: number;\n productId: number;\n detailKey: string;\n detailValue: string;\n extraInfo: string;\n}\n\n// 产品选项值类型\nexport interface ProductOptionValue {\n valueId: number;\n optionId: number;\n value: string;\n description: string;\n priceAdjustment: string;\n createdAt: any;\n updatedAt: any;\n}\n\n// 产品选项类型\nexport interface ProductOption {\n optionId: number;\n productId: number;\n optionName: string;\n createdAt: any;\n updatedAt: any;\n values: ProductOptionValue[];\n}\n\n// 产品变体类型\nexport interface ProductVariant {\n variantId: number;\n productId: number;\n sku: string;\n price: string;\n stock: number;\n createdAt: any;\n updatedAt: any;\n}\n\n// 产品图片类型\nexport interface ProductImage {\n imageId: number;\n productId: number;\n productDetailId: number | null;\n optionValueId: number | null;\n imageUrl: string;\n imageType: 'gallery' | 'thumbnail' | 'detail';\n sortOrder: number;\n createdAt: any;\n updatedAt: any;\n}\n\n// 地区类型\nexport interface Region {\n regionId: number;\n platformId: number;\n regionCode: string;\n regionName: string;\n regionLevel: string;\n parentId: number;\n children?: Region[];\n}\n\n// 运费规则类型\nexport interface ShippingRule {\n ruleId: number;\n templateId: number;\n regionId: number;\n firstUnit: string;\n firstFee: string;\n additionalUnit: string;\n additionalFee: string;\n conditionType: string;\n conditionValue: string | null;\n createTime: any;\n updateTime: any;\n}\n\n// 运费模板类型\nexport interface ShippingTemplate {\n templateId: number;\n platformId: number;\n templateName: string;\n defaultFee: string;\n freeShippingLimit: string;\n createTime: any;\n updateTime: any;\n rules: ShippingRule[];\n}\n\n// 运费响应类型\nexport interface ShippingResponse {\n platformId: number;\n templates: ShippingTemplate[];\n generatedAt: string;\n}\n\n// 税费规则类型\nexport interface TaxRule {\n ruleId: number;\n templateId: number;\n regionId: number;\n taxRate: string;\n createTime: any;\n updateTime: any;\n}\n\n// 税费模板类型\nexport interface TaxTemplate {\n templateId: number;\n platformId: number;\n templateName: string;\n defaultTaxRate: string;\n createTime: any;\n updateTime: any;\n rules: TaxRule[];\n}\n\n// 税费响应类型\nexport interface TaxResponse {\n platformId: number;\n templates: TaxTemplate[];\n generatedAt: string;\n}\n\n// 订阅类型\nexport interface Subscription {\n subscriptionId: number;\n productId: number;\n billingCycle: number;\n billingCycleUnit: string;\n billingCycleCount: number;\n setupFee: string;\n trialDays: number;\n trialPrice: string;\n renewalDiscount: string;\n autoRenew: boolean;\n allowCancel: boolean;\n cancelPolicy: string;\n refundPolicy: string;\n maxCycles: number;\n gracePeriod: number;\n createdAt: any;\n updatedAt: any;\n}\n\n// 批发类型\nexport interface Wholesale {\n wholesaleId: number;\n productId: number;\n minOrderQuantity: number;\n maxOrderQuantity: number;\n allowMixedVariants: boolean;\n showRetailPrice: boolean;\n wholesaleDescription: string;\n paymentTerms: string;\n shippingTerms: string;\n}\n\n// 价格层级类型\nexport interface PriceTier {\n tierId: number;\n wholesaleId: number;\n userLevel: number | null;\n minQuantity: number;\n maxQuantity: number;\n priceType: number;\n priceValue: string;\n sortOrder: number;\n}\n\n// 变体价格类型\nexport interface VariantPrice {\n id: number;\n wholesaleId: number;\n tierId: number;\n variantId: number;\n priceType: number;\n priceValue: string;\n}\n\n// 众筹类型\nexport interface Crowdfunding {\n crowdfundingId: number;\n productId: number;\n targetAmount: string;\n currentAmount: string;\n supporterCount: number;\n startTime: any;\n endTime: any;\n status: number;\n minSupportAmount: string;\n allowOverFunding: boolean;\n overFundingLimit: string;\n createdAt: any;\n updatedAt: any;\n}\n\n// 众筹奖励类型\nexport interface Reward {\n rewardId: number;\n crowdfundingId: number;\n variantId: number;\n rewardName: string;\n rewardDescription: string;\n rewardAmount: string;\n rewardLimit: number;\n rewardClaimed: number;\n shippingRequired: boolean;\n estimatedDeliveryTime: any;\n sortOrder: number;\n createdAt: any;\n updatedAt: any;\n}\n\n// 众筹更新类型\nexport interface CrowdfundingUpdate {\n updateId: number;\n crowdfundingId: number;\n updateTitle: string;\n updateContent: string;\n isPublic: boolean;\n updateTime: any;\n}\n\n// 众筹FAQ类型\nexport interface CrowdfundingFAQ {\n faqId: number;\n crowdfundingId: number;\n question: string;\n answer: string;\n sortOrder: number;\n createdAt: any;\n updatedAt: any;\n}\n\n// 简单理财类型\nexport interface SimpleFinance {\n simpleFinanceId: number;\n productId: number;\n calculationPeriod: number;\n calculationPeriodUnit: string;\n interestRate: string;\n minInvestment: string;\n maxInvestment: string;\n minInvestmentUnit: string;\n maxInvestmentUnit: string;\n investmentPeriod: number;\n investmentPeriodUnit: string;\n}\n\n// 产品类型\nexport interface Product {\n productId: number;\n productName: string;\n description: string;\n metaKeywords: string;\n price: string;\n priceChangePercent: string;\n status: number;\n productType: number;\n native: number;\n shared: number;\n createdAt: any;\n updatedAt: any;\n platformId: number;\n oldProductId: number | null;\n details: ProductDetail[];\n options: ProductOption[];\n variants: ProductVariant[];\n images: ProductImage[];\n categories: ProductCategory[];\n tags: ProductTag[];\n regions: Region[];\n shippingTemplates: ShippingTemplate[];\n taxTemplates: TaxTemplate[];\n subscription?: Subscription; // 当productType为2时存在\n wholesale?: Wholesale; // 当productType为3时存在\n priceTiers?: PriceTier[]; // 当productType为3时存在\n variantPrices?: VariantPrice[]; // 当productType为3时存在\n crowdfunding?: Crowdfunding; // 当productType为4时存在\n rewards?: Reward[]; // 当productType为4时存在\n updates?: CrowdfundingUpdate[]; // 当productType为4时存在\n faqs?: CrowdfundingFAQ[]; // 当productType为4时存在\n simpleFinance?: SimpleFinance; // 当productType为5时存在\n generatedAt: string;\n}\n\n// 文章列表项类型(简化版)\nexport interface ArticleListItem {\n articleId: number;\n title: string;\n status: string;\n publishedAt: string;\n categories: Category[];\n tags: Tag[];\n coverImage?: string;\n}\n\n// 产品列表项类型(简化版)\nexport interface ProductListItem {\n productId: number;\n productName: string;\n price: string;\n status: number;\n categories: ProductCategory[];\n tags: ProductTag[];\n coverImage?: string;\n}\n\n// 错误类型\nexport class GT6Error extends Error {\n constructor(\n message: string,\n public statusCode?: number\n ) {\n super(message);\n this.name = 'GT6Error';\n }\n}\n\n// 查询参数类型\nexport interface ArticleQueryParams {\n categoryId?: number;\n tagId?: number;\n status?: string;\n limit?: number;\n offset?: number;\n sortBy?: 'publishedAt' | 'title' | 'sortOrder';\n sortOrder?: 'asc' | 'desc';\n}\n\n// 产品查询参数类型\nexport interface ProductQueryParams {\n categoryId?: number;\n tagId?: number;\n status?: number;\n limit?: number;\n offset?: number;\n sortBy?: 'price' | 'productName' | 'sortOrder';\n sortOrder?: 'asc' | 'desc';\n}\n\n// 根据标签获取文章的选项类型\nexport interface ArticlesByTagOptions {\n page?: number;\n limit?: number;\n status?: 'published' | 'draft' | 'archived';\n tagAlias?: string;\n}\n\n// 根据分类获取文章的选项类型\nexport interface ArticlesByCategoryOptions {\n page?: number;\n limit?: number;\n status?: 'published' | 'draft' | 'archived';\n}\n\n// 根据标签获取产品的选项类型\nexport interface ProductsByTagOptions {\n page?: number;\n limit?: number;\n status?: number;\n productTagAlias?: string;\n}\n\n// 根据分类获取产品的选项类型\nexport interface ProductsByCategoryOptions {\n page?: number;\n limit?: number;\n status?: number;\n}\n\n// 文章统计类型\nexport interface ArticleStats {\n total: number;\n published: number;\n draft: number;\n archived: number;\n byCategory: Record<number, number>;\n byTag: Record<number, number>;\n}\n\n// 产品统计类型\nexport interface ProductStats {\n total: number;\n active: number;\n inactive: number;\n byCategory: Record<number, number>;\n byTag: Record<number, number>;\n}\n\nexport interface GT6Response<T> {\n success: boolean;\n data: T;\n error?: string;\n}\n\nexport interface ArticleResponse {\n article: Article;\n}\n\nexport interface ProductResponse {\n product: Product;\n}\n\nexport interface CategoryResponse {\n categories: Category[];\n}\n\nexport interface ProductCategoryResponse {\n categories: ProductCategory[];\n}\n\nexport interface TagResponse {\n tags: Tag[];\n}\n\nexport interface ProductTagResponse {\n tags: ProductTag[];\n}\n\n// 区域响应类型\nexport interface RegionResponse {\n platformId: number;\n regions: Region[];\n generatedAt: string;\n} ","import { GT6Config, GT6Error } from './types';\r\n\r\nexport class GT6Client {\r\n private config: GT6Config;\r\n private cache: Map<string, { data: any; timestamp: number }>;\r\n\r\n constructor(config: GT6Config) {\r\n this.config = {\r\n timeout: 10000,\r\n cache: {\r\n enabled: true,\r\n ttl: 300000 // 5分钟默认缓存\r\n },\r\n ...config\r\n };\r\n this.cache = new Map();\r\n }\r\n\r\n /**\r\n * 发起HTTP请求\r\n */\r\n async request<T>(endpoint: string, options: RequestInit = {}): Promise<T> {\r\n const url = `${this.config.baseUrl}${endpoint}`;\r\n const cacheKey = `${options.method || 'GET'}:${url}`;\r\n\r\n // 检查缓存(只对GET请求缓存)\r\n if (this.config.cache?.enabled && options.method !== 'POST' && options.method !== 'PUT' && options.method !== 'DELETE') {\r\n const cached = this.cache.get(cacheKey);\r\n if (cached && Date.now() - cached.timestamp < this.config.cache.ttl) {\r\n return cached.data;\r\n }\r\n }\r\n\r\n try {\r\n const controller = new AbortController();\r\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\r\n\r\n const response = await fetch(url, {\r\n ...options,\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n ...options.headers,\r\n },\r\n signal: controller.signal\r\n });\r\n\r\n clearTimeout(timeoutId);\r\n\r\n if (!response.ok) {\r\n throw new GT6Error(\r\n `HTTP ${response.status}: ${response.statusText}`,\r\n response.status\r\n );\r\n }\r\n\r\n const data = await response.json();\r\n\r\n // 更新缓存(只对GET请求缓存)\r\n if (this.config.cache?.enabled && options.method !== 'POST' && options.method !== 'PUT' && options.method !== 'DELETE') {\r\n this.cache.set(cacheKey, { data, timestamp: Date.now() });\r\n }\r\n\r\n return data;\r\n } catch (error: any) {\r\n if (error instanceof GT6Error) {\r\n throw error;\r\n }\r\n \r\n if (error.name === 'AbortError') {\r\n throw new GT6Error('Request timeout', 408);\r\n }\r\n \r\n throw new GT6Error(`Network error: ${error.message}`);\r\n }\r\n }\r\n\r\n /**\r\n * 获取配置\r\n */\r\n getConfig(): GT6Config {\r\n return { ...this.config };\r\n }\r\n\r\n /**\r\n * 清除缓存\r\n */\r\n clearCache(): void {\r\n this.cache.clear();\r\n }\r\n\r\n /**\r\n * 获取缓存统计\r\n */\r\n getCacheStats(): { size: number; entries: Array<{ key: string; age: number }> } {\r\n const entries = Array.from(this.cache.entries()).map(([key, value]) => ({\r\n key,\r\n age: Date.now() - value.timestamp\r\n }));\r\n\r\n return {\r\n size: this.cache.size,\r\n entries\r\n };\r\n }\r\n} ","import { GT6Client } from '../core/client';\r\nimport {\r\n Article,\r\n Category,\r\n Tag,\r\n CategoryResponse,\r\n TagResponse,\r\n ArticlesByTagOptions,\r\n ArticlesByCategoryOptions\r\n} from '../core/types';\r\n\r\nexport class ArticlesAPI {\r\n constructor(private client: GT6Client) {}\r\n\r\n /**\r\n * 1. 根据文章ID获取文章详情\r\n */\r\n async getArticle(articleId: number | string): Promise<Article> {\r\n return this.client.request<Article>(`/articles/${articleId}.json`);\r\n }\r\n\r\n /**\r\n * 2. 获取文章分类列表\r\n */\r\n async getCategories(rootCategoryId?: number | string): Promise<Category[]> {\r\n const config = this.client.getConfig();\r\n const categoryId = rootCategoryId || config.rootCategoryId || '671920';\r\n \r\n const response = await this.client.request<CategoryResponse>(\r\n `/article-categories/platform-${config.platformId}-root-${categoryId}.json`\r\n );\r\n \r\n return response.categories;\r\n }\r\n\r\n /**\r\n * 3. 获取文章标签列表\r\n */\r\n async getTags(tagAlias?: string): Promise<Tag[]> {\r\n const config = this.client.getConfig();\r\n const alias = tagAlias || config.tagAlias || '001';\r\n \r\n const response = await this.client.request<TagResponse>(\r\n `/article-tags/platform-${config.platformId}-${alias}.json`\r\n );\r\n \r\n return response.tags;\r\n }\r\n\r\n /**\r\n * 4. 根据分类ID获取文章列表\r\n * 支持单个分类ID或分类ID数组\r\n */\r\n async getArticlesByCategory(categoryId: number | number[], options?: ArticlesByCategoryOptions): Promise<{\r\n articles: Article[];\r\n total: number;\r\n page: number;\r\n limit: number;\r\n }> {\r\n // 获取分类数据\r\n const categories = await this.getCategories();\r\n \r\n // 将单个分类ID转换为数组\r\n const categoryIds = Array.isArray(categoryId) ? categoryId : [categoryId];\r\n \r\n // 收集所有指定分类下的文章ID\r\n const allArticleIds: number[] = [];\r\n \r\n categoryIds.forEach(id => {\r\n const targetCategory = categories.find(cat => cat.categoryId === id);\r\n if (targetCategory) {\r\n allArticleIds.push(...targetCategory.articleIds);\r\n }\r\n });\r\n \r\n // 去重\r\n const uniqueArticleIds = [...new Set(allArticleIds)];\r\n \r\n if (uniqueArticleIds.length === 0) {\r\n return {\r\n articles: [],\r\n total: 0,\r\n page: options?.page || 1,\r\n limit: options?.limit || 10\r\n };\r\n }\r\n \r\n // 应用分页\r\n const page = options?.page || 1;\r\n const limit = options?.limit || 10;\r\n const offset = (page - 1) * limit;\r\n const paginatedArticleIds = uniqueArticleIds.slice(offset, offset + limit);\r\n \r\n // 获取文章详情\r\n const articles = await Promise.all(\r\n paginatedArticleIds.map(articleId => this.getArticle(articleId))\r\n );\r\n \r\n // 应用状态过滤\r\n let filteredArticles = articles;\r\n if (options?.status) {\r\n filteredArticles = articles.filter(article => article.status === options.status);\r\n }\r\n \r\n return {\r\n articles: filteredArticles,\r\n total: uniqueArticleIds.length,\r\n page,\r\n limit\r\n };\r\n }\r\n\r\n /**\r\n * 5. 根据标签ID获取文章列表\r\n * 支持单个标签ID或标签ID数组\r\n */\r\n async getArticlesByTag(tagId: number | number[], options?: ArticlesByTagOptions): Promise<{\r\n articles: Article[];\r\n total: number;\r\n page: number;\r\n limit: number;\r\n }> {\r\n // 获取标签数据,传递tagAlias参数\r\n const tags = await this.getTags(options?.tagAlias);\r\n \r\n // 将单个标签ID转换为数组\r\n const tagIds = Array.isArray(tagId) ? tagId : [tagId];\r\n \r\n // 收集所有指定标签下的文章ID\r\n const allArticleIds: number[] = [];\r\n \r\n tagIds.forEach(id => {\r\n const targetTag = tags.find(tag => tag.tagId === id);\r\n if (targetTag) {\r\n allArticleIds.push(...targetTag.articleIds);\r\n }\r\n });\r\n \r\n // 去重\r\n const uniqueArticleIds = [...new Set(allArticleIds)];\r\n \r\n if (uniqueArticleIds.length === 0) {\r\n return {\r\n articles: [],\r\n total: 0,\r\n page: options?.page || 1,\r\n limit: options?.limit || 10\r\n };\r\n }\r\n \r\n // 应用分页\r\n const page = options?.page || 1;\r\n const limit = options?.limit || 10;\r\n const offset = (page - 1) * limit;\r\n const paginatedArticleIds = uniqueArticleIds.slice(offset, offset + limit);\r\n \r\n // 获取文章详情\r\n const articles = await Promise.all(\r\n paginatedArticleIds.map(articleId => this.getArticle(articleId))\r\n );\r\n \r\n // 应用状态过滤\r\n let filteredArticles = articles;\r\n if (options?.status) {\r\n filteredArticles = articles.filter(article => article.status === options.status);\r\n }\r\n \r\n return {\r\n articles: filteredArticles,\r\n total: uniqueArticleIds.length,\r\n page,\r\n limit\r\n };\r\n }\r\n\r\n /**\r\n * 6. 根据分类ID获取该分类的层级路径\r\n * 用于前端面包屑导航\r\n */\r\n async getCategoryPath(categoryId: number): Promise<{\r\n path: Category[];\r\n currentCategory: Category | null;\r\n breadcrumbs: Array<{\r\n categoryId: number;\r\n categoryName: string;\r\n level: number;\r\n }>;\r\n }> {\r\n // 获取所有分类数据\r\n const categories = await this.getCategories();\r\n \r\n // 查找目标分类\r\n const targetCategory = categories.find(cat => cat.categoryId === categoryId);\r\n \r\n if (!targetCategory) {\r\n return {\r\n path: [],\r\n currentCategory: null,\r\n breadcrumbs: []\r\n };\r\n }\r\n \r\n // 构建分类路径\r\n const path: Category[] = [];\r\n const breadcrumbs: Array<{\r\n categoryId: number;\r\n categoryName: string;\r\n level: number;\r\n }> = [];\r\n \r\n // 递归查找父分类\r\n const buildPath = (currentCategory: Category, level: number = 0): void => {\r\n // 将当前分类添加到路径开头(因为我们要从根到叶子构建)\r\n path.unshift(currentCategory);\r\n breadcrumbs.unshift({\r\n categoryId: currentCategory.categoryId,\r\n categoryName: currentCategory.categoryName,\r\n level\r\n });\r\n \r\n // 如果有父分类,继续递归\r\n if (currentCategory.parentId && currentCategory.parentId !== 0) {\r\n const parentCategory = categories.find(cat => cat.categoryId === currentCategory.parentId);\r\n if (parentCategory) {\r\n buildPath(parentCategory, level + 1);\r\n }\r\n }\r\n };\r\n \r\n // 从目标分类开始构建路径\r\n buildPath(targetCategory);\r\n \r\n return {\r\n path,\r\n currentCategory: targetCategory,\r\n breadcrumbs\r\n };\r\n }\r\n\r\n /**\r\n * 7. 获取指定分类ID下的子分类\r\n * 支持递归获取所有层级的子分类\r\n */\r\n async getSubCategories(categoryId: number, options?: {\r\n recursive?: boolean; // 是否递归获取所有层级的子分类\r\n includeCurrent?: boolean; // 是否包含当前分类\r\n maxDepth?: number; // 最大递归深度,默认不限制\r\n }): Promise<{\r\n subCategories: Category[];\r\n currentCategory: Category | null;\r\n total: number;\r\n depth: number; // 实际递归深度\r\n }> {\r\n // 获取所有分类数据\r\n const categories = await this.getCategories();\r\n \r\n // 查找目标分类\r\n const targetCategory = categories.find(cat => cat.categoryId === categoryId);\r\n \r\n if (!targetCategory) {\r\n return {\r\n subCategories: [],\r\n currentCategory: null,\r\n total: 0,\r\n depth: 0\r\n };\r\n }\r\n \r\n const subCategories: Category[] = [];\r\n let maxDepth = options?.maxDepth || Infinity;\r\n let actualDepth = 0;\r\n \r\n // 递归获取子分类的函数\r\n const collectSubCategories = (parentId: number, currentDepth: number = 0): void => {\r\n if (currentDepth >= maxDepth) {\r\n return;\r\n }\r\n \r\n // 查找直接子分类\r\n const children = categories.filter(cat => cat.parentId === parentId);\r\n \r\n children.forEach(child => {\r\n subCategories.push(child);\r\n \r\n // 如果需要递归且未达到最大深度,继续查找子分类\r\n if (options?.recursive && currentDepth < maxDepth - 1) {\r\n collectSubCategories(child.categoryId, currentDepth + 1);\r\n }\r\n });\r\n \r\n // 更新实际深度\r\n actualDepth = Math.max(actualDepth, currentDepth);\r\n };\r\n \r\n // 开始收集子分类\r\n collectSubCategories(categoryId);\r\n \r\n // 如果需要包含当前分类,添加到结果中\r\n if (options?.includeCurrent) {\r\n subCategories.unshift(targetCategory);\r\n }\r\n \r\n return {\r\n subCategories,\r\n currentCategory: targetCategory,\r\n total: subCategories.length,\r\n depth: actualDepth\r\n };\r\n }\r\n} ","import { GT6Client } from '../core/client';\r\nimport {\r\n Product,\r\n ProductCategory,\r\n ProductTag,\r\n ProductCategoryResponse,\r\n ProductTagResponse,\r\n ProductsByTagOptions,\r\n ProductsByCategoryOptions,\r\n TaxResponse,\r\n ShippingResponse,\r\n RegionResponse\r\n} from '../core/types';\r\n\r\nexport class ProductsAPI {\r\n constructor(private client: GT6Client) {}\r\n\r\n /**\r\n * 1. 根据产品ID获取产品详情\r\n */\r\n async getProduct(productId: number | string): Promise<Product> {\r\n const product = await this.client.request<Product>(`/products/${productId}.json`);\r\n \r\n // 检查产品是否有销售区域和税费模板\r\n if (product.regions && product.regions.length > 0 && \r\n product.taxTemplates && product.taxTemplates.length > 0) {\r\n try {\r\n // 获取税费信息\r\n const taxInfo = await this.getTaxInfo();\r\n \r\n // 为每个税费模板添加规则\r\n product.taxTemplates = product.taxTemplates.map(template => {\r\n const matchingTemplate = taxInfo.templates.find(t => t.templateId === template.templateId);\r\n if (matchingTemplate) {\r\n // 过滤出产品可销售区域的规则\r\n const productRegionIds = product.regions.map(r => r.regionId);\r\n const applicableRules = matchingTemplate.rules.filter(rule => \r\n productRegionIds.includes(rule.regionId)\r\n );\r\n \r\n return {\r\n ...template,\r\n rules: applicableRules\r\n };\r\n }\r\n return template;\r\n });\r\n } catch (error) {\r\n // 如果获取税费信息失败,不影响产品详情返回\r\n console.warn('Failed to fetch tax info:', error);\r\n }\r\n }\r\n \r\n // 检查产品是否有销售区域和运费模板\r\n if (product.regions && product.regions.length > 0 && \r\n product.shippingTemplates && product.shippingTemplates.length > 0) {\r\n try {\r\n // 获取运费信息\r\n const shippingInfo = await this.getShippingInfo();\r\n \r\n // 为每个运费模板添加规则\r\n product.shippingTemplates = product.shippingTemplates.map(template => {\r\n const matchingTemplate = shippingInfo.templates.find(t => t.templateId === template.templateId);\r\n if (matchingTemplate) {\r\n // 过滤出产品可销售区域的规则\r\n const productRegionIds = product.regions.map(r => r.regionId);\r\n const applicableRules = matchingTemplate.rules.filter(rule => \r\n productRegionIds.includes(rule.regionId)\r\n );\r\n \r\n return {\r\n ...template,\r\n rules: applicableRules\r\n };\r\n }\r\n return template;\r\n });\r\n } catch (error) {\r\n // 如果获取运费信息失败,不影响产品详情返回\r\n console.warn('Failed to fetch shipping info:', error);\r\n }\r\n }\r\n \r\n return product;\r\n }\r\n\r\n /**\r\n * 2. 获取产品分类列表\r\n */\r\n async getCategories(productRootCategoryId?: number | string): Promise<ProductCategory[]> {\r\n const config = this.client.getConfig();\r\n const categoryId = productRootCategoryId || config.productRootCategoryId || '277233';\r\n \r\n const response = await this.client.request<ProductCategoryResponse>(\r\n `/product-categories/platform-${config.platformId}-root-${categoryId}.json`\r\n );\r\n \r\n return response.categories;\r\n }\r\n\r\n /**\r\n * 3. 获取产品标签列表\r\n */\r\n async getTags(productTagAlias?: string): Promise<ProductTag[]> {\r\n const config = this.client.getConfig();\r\n const alias = productTagAlias || config.productTagAlias || '01';\r\n \r\n const response = await this.client.request<ProductTagResponse>(\r\n `/product-tags/platform-${config.platformId}-${alias}.json`\r\n );\r\n \r\n return response.tags;\r\n }\r\n\r\n /**\r\n * 4. 根据分类ID获取产品列表\r\n * 支持单个分类ID或分类ID数组\r\n */\r\n async getProductsByCategory(categoryId: number | number[], options?: ProductsByCategoryOptions): Promise<{\r\n products: Product[];\r\n total: number;\r\n page: number;\r\n limit: number;\r\n }> {\r\n // 获取分类数据\r\n const categories = await this.getCategories();\r\n \r\n // 将单个分类ID转换为数组\r\n const categoryIds = Array.isArray(categoryId) ? categoryId : [categoryId];\r\n \r\n // 收集所有指定分类下的产品ID\r\n const allProductIds: number[] = [];\r\n \r\n categoryIds.forEach(id => {\r\n const targetCategory = categories.find(cat => cat.categoryId === id);\r\n if (targetCategory) {\r\n allProductIds.push(...targetCategory.productIds);\r\n }\r\n });\r\n \r\n // 去重\r\n const uniqueProductIds = [...new Set(allProductIds)];\r\n \r\n if (uniqueProductIds.length === 0) {\r\n return {\r\n products: [],\r\n total: 0,\r\n page: options?.page || 1,\r\n limit: options?.limit || 10\r\n };\r\n }\r\n \r\n // 应用分页\r\n const page = options?.page || 1;\r\n const limit = options?.limit || 10;\r\n const offset = (page - 1) * limit;\r\n const paginatedProductIds = uniqueProductIds.slice(offset, offset + limit);\r\n \r\n // 获取产品详情\r\n const products = await Promise.all(\r\n paginatedProductIds.map(productId => this.getProduct(productId))\r\n );\r\n \r\n // 应用状态过滤\r\n let filteredProducts = products;\r\n if (options?.status !== undefined) {\r\n filteredProducts = products.filter(product => product.status === options.status);\r\n }\r\n \r\n return {\r\n products: filteredProducts,\r\n total: uniqueProductIds.length,\r\n page,\r\n limit\r\n };\r\n }\r\n\r\n /**\r\n * 5. 根据标签ID获取产品列表\r\n * 支持单个标签ID或标签ID数组\r\n */\r\n async getProductsByTag(tagId: number | number[], options?: ProductsByTagOptions): Promise<{\r\n products: Product[];\r\n total: number;\r\n page: number;\r\n limit: number;\r\n }> {\r\n // 获取标签数据,传递productTagAlias参数\r\n const tags = await this.getTags(options?.productTagAlias);\r\n \r\n // 将单个标签ID转换为数组\r\n const tagIds = Array.isArray(tagId) ? tagId : [tagId];\r\n \r\n // 收集所有指定标签下的产品ID\r\n const allProductIds: number[] = [];\r\n \r\n tagIds.forEach(id => {\r\n const targetTag = tags.find(tag => tag.tagId === id);\r\n if (targetTag) {\r\n allProductIds.push(...targetTag.productIds);\r\n }\r\n });\r\n \r\n // 去重\r\n const uniqueProductIds = [...new Set(allProductIds)];\r\n \r\n if (uniqueProductIds.length === 0) {\r\n return {\r\n products: [],\r\n total: 0,\r\n page: options?.page || 1,\r\n limit: options?.limit || 10\r\n };\r\n }\r\n \r\n // 应用分页\r\n const page = options?.page || 1;\r\n const limit = options?.limit || 10;\r\n const offset = (page - 1) * limit;\r\n const paginatedProductIds = uniqueProductIds.slice(offset, offset + limit);\r\n \r\n // 获取产品详情\r\n const products = await Promise.all(\r\n paginatedProductIds.map(productId => this.getProduct(productId))\r\n );\r\n \r\n // 应用状态过滤\r\n let filteredProducts = products;\r\n if (options?.status !== undefined) {\r\n filteredProducts = products.filter(product => product.status === options.status);\r\n }\r\n \r\n return {\r\n products: filteredProducts,\r\n total: uniqueProductIds.length,\r\n page,\r\n limit\r\n };\r\n }\r\n\r\n /**\r\n * 6. 根据分类ID获取该分类的层级路径\r\n * 用于前端面包屑导航\r\n */\r\n async getCategoryPath(categoryId: number): Promise<{\r\n path: ProductCategory[];\r\n currentCategory: ProductCategory | null;\r\n breadcrumbs: Array<{\r\n categoryId: number;\r\n categoryName: string;\r\n level: number;\r\n }>;\r\n }> {\r\n // 获取所有分类数据\r\n const categories = await this.getCategories();\r\n \r\n // 查找目标分类\r\n const targetCategory = categories.find(cat => cat.categoryId === categoryId);\r\n \r\n if (!targetCategory) {\r\n return {\r\n path: [],\r\n currentCategory: null,\r\n breadcrumbs: []\r\n };\r\n }\r\n \r\n // 构建分类路径\r\n const path: ProductCategory[] = [];\r\n const breadcrumbs: Array<{\r\n categoryId: number;\r\n categoryName: string;\r\n level: number;\r\n }> = [];\r\n \r\n // 递归查找父分类\r\n const buildPath = (currentCategory: ProductCategory, level: number = 0): void => {\r\n // 将当前分类添加到路径开头(因为我们要从根到叶子构建)\r\n path.unshift(currentCategory);\r\n breadcrumbs.unshift({\r\n categoryId: currentCategory.categoryId,\r\n categoryName: currentCategory.categoryName,\r\n level\r\n });\r\n \r\n // 如果有父分类,继续递归\r\n if (currentCategory.parentId && currentCategory.parentId !== 0) {\r\n const parentCategory = categories.find(cat => cat.categoryId === currentCategory.parentId);\r\n if (parentCategory) {\r\n buildPath(parentCategory, level + 1);\r\n }\r\n }\r\n };\r\n \r\n // 从目标分类开始构建路径\r\n buildPath(targetCategory);\r\n \r\n return {\r\n path,\r\n currentCategory: targetCategory,\r\n breadcrumbs\r\n };\r\n }\r\n\r\n /**\r\n * 7. 获取指定分类ID下的子分类\r\n * 支持递归获取所有层级的子分类\r\n */\r\n async getSubCategories(categoryId: number, options?: {\r\n recursive?: boolean; // 是否递归获取所有层级的子分类\r\n includeCurrent?: boolean; // 是否包含当前分类\r\n maxDepth?: number; // 最大递归深度,默认不限制\r\n }): Promise<{\r\n subCategories: ProductCategory[];\r\n currentCategory: ProductCategory | null;\r\n total: number;\r\n depth: number; // 实际递归深度\r\n }> {\r\n // 获取所有分类数据\r\n const categories = await this.getCategories();\r\n \r\n // 查找目标分类\r\n const targetCategory = categories.find(cat => cat.categoryId === categoryId);\r\n \r\n if (!targetCategory) {\r\n return {\r\n subCategories: [],\r\n currentCategory: null,\r\n total: 0,\r\n depth: 0\r\n };\r\n }\r\n \r\n const subCategories: ProductCategory[] = [];\r\n let maxDepth = options?.maxDepth || Infinity;\r\n let actualDepth = 0;\r\n \r\n // 递归获取子分类的函数\r\n const collectSubCategories = (parentId: number, currentDepth: number = 0): void => {\r\n if (currentDepth >= maxDepth) {\r\n return;\r\n }\r\n \r\n // 查找直接子分类\r\n const children = categories.filter(cat => cat.parentId === parentId);\r\n \r\n children.forEach(child => {\r\n subCategories.push(child);\r\n \r\n // 如果需要递归且未达到最大深度,继续查找子分类\r\n if (options?.recursive && currentDepth < maxDepth - 1) {\r\n collectSubCategories(child.categoryId, currentDepth + 1);\r\n }\r\n });\r\n \r\n // 更新实际深度\r\n actualDepth = Math.max(actualDepth, currentDepth);\r\n };\r\n \r\n // 开始收集子分类\r\n collectSubCategories(categoryId);\r\n \r\n // 如果需要包含当前分类,添加到结果中\r\n if (options?.includeCurrent) {\r\n subCategories.unshift(targetCategory);\r\n }\r\n \r\n return {\r\n subCategories,\r\n currentCategory: targetCategory,\r\n total: subCategories.length,\r\n depth: actualDepth\r\n };\r\n }\r\n\r\n /**\r\n * 8. 获取税费信息\r\n * 获取平台的所有税费模板和规则\r\n */\r\n async getTaxInfo(): Promise<TaxResponse> {\r\n const config = this.client.getConfig();\r\n return this.client.request<TaxResponse>(`/tax/platform-${config.platformId}.json`);\r\n }\r\n\r\n /**\r\n * 9. 获取运费信息\r\n * 获取平台的所有运费模板和规则\r\n */\r\n async getShippingInfo(): Promise<ShippingResponse> {\r\n const config = this.client.getConfig();\r\n return this.client.request<ShippingResponse>(`/shipping/platform-${config.platformId}.json`);\r\n }\r\n\r\n /**\r\n * 10. 获取区域信息\r\n * 获取平台的所有区域信息,包括层级结构\r\n */\r\n async getRegions(): Promise<RegionResponse> {\r\n const config = this.client.getConfig();\r\n return this.client.request<RegionResponse>(`/regions/platform-${config.platformId}.json`);\r\n }\r\n} ","import { GT6Client } from './core/client';\r\nimport { ArticlesAPI } from './modules/articles';\r\nimport { ProductsAPI } from './modules/products';\r\nimport { \r\n GT6Config, \r\n ArticlesByCategoryOptions, \r\n ArticlesByTagOptions,\r\n ProductsByCategoryOptions,\r\n ProductsByTagOptions\r\n} from './core/types';\r\n\r\n/**\r\n * GT6 SDK 主类\r\n * 提供文章和产品管理相关的所有功能\r\n */\r\nexport class GT6SDK {\r\n public articles: ArticlesAPI;\r\n public products: ProductsAPI;\r\n\r\n constructor(config: GT6Config) {\r\n const client = new GT6Client(config);\r\n this.articles = new ArticlesAPI(client);\r\n this.products = new ProductsAPI(client);\r\n }\r\n\r\n /**\r\n * 获取客户端实例(用于高级用法)\r\n */\r\n getClient(): GT6Client {\r\n return (this.articles as any).client;\r\n }\r\n\r\n /**\r\n * 清除所有缓存\r\n */\r\n clearCache(): void {\r\n this.getClient().clearCache();\r\n }\r\n\r\n /**\r\n * 获取缓存统计信息\r\n */\r\n getCacheStats() {\r\n return this.getClient().getCacheStats();\r\n }\r\n\r\n /**\r\n * 1. 便捷方法:根据文章ID获取文章详情\r\n */\r\n async getArticle(articleId: number | string) {\r\n return this.articles.getArticle(articleId);\r\n }\r\n\r\n /**\r\n * 2. 便捷方法:获取文章分类列表\r\n */\r\n async getCategories(rootCategoryId?: number | string) {\r\n return this.articles.getCategories(rootCategoryId);\r\n }\r\n\r\n /**\r\n * 3. 便捷方法:获取文章标签列表\r\n */\r\n async getTags(tagAlias?: string) {\r\n return this.articles.getTags(tagAlias);\r\n }\r\n\r\n /**\r\n * 4. 便捷方法:根据分类ID获取文章列表\r\n */\r\n async getArticlesByCategory(categoryId: number | number[], options?: ArticlesByCategoryOptions) {\r\n return this.articles.getArticlesByCategory(categoryId, options);\r\n }\r\n\r\n /**\r\n * 5. 便捷方法:根据标签ID获取文章列表\r\n */\r\n async getArticlesByTag(tagId: number | number[], options?: ArticlesByTagOptions) {\r\n return this.articles.getArticlesByTag(tagId, options);\r\n }\r\n\r\n /**\r\n * 6. 便捷方法:根据分类ID获取该分类的层级路径\r\n */\r\n async getCategoryPath(categoryId: number) {\r\n return this.articles.getCategoryPath(categoryId);\r\n }\r\n\r\n /**\r\n * 7. 便捷方法:获取指定分类ID下的子分类\r\n */\r\n async getSubCategories(categoryId: number, options?: {\r\n recursive?: boolean;\r\n includeCurrent?: boolean;\r\n maxDepth?: number;\r\n }) {\r\n return this.articles.getSubCategories(categoryId, options);\r\n }\r\n\r\n /**\r\n * 8. 便捷方法:根据产品ID获取产品详情\r\n */\r\n async getProduct(productId: number | string) {\r\n return this.products.getProduct(productId);\r\n }\r\n\r\n /**\r\n * 9. 便捷方法:获取产品分类列表\r\n */\r\n async getProductCategories(productRootCategoryId?: number | string) {\r\n return this.products.getCategories(productRootCategoryId);\r\n }\r\n\r\n /**\r\n * 10. 便捷方法:获取产品标签列表\r\n */\r\n async getProductTags(productTagAlias?: string) {\r\n return this.products.getTags(productTagAlias);\r\n }\r\n\r\n /**\r\n * 11. 便捷方法:根据分类ID获取产品列表\r\n */\r\n async getProductsByCategory(categoryId: number | number[], options?: ProductsByCategoryOptions) {\r\n return this.products.getProductsByCategory(categoryId, options);\r\n }\r\n\r\n /**\r\n * 12. 便捷方法:根据标签ID获取产品列表\r\n */\r\n async getProductsByTag(tagId: number | number[], options?: ProductsByTagOptions) {\r\n return this.products.getProductsByTag(tagId, options);\r\n }\r\n\r\n /**\r\n * 13. 便捷方法:根据分类ID获取该分类的层级路径\r\n */\r\n async getProductCategoryPath(categoryId: number) {\r\n return this.products.getCategoryPath(categoryId);\r\n }\r\n\r\n /**\r\n * 14. 便捷方法:获取指定分类ID下的子分类\r\n */\r\n async getProductSubCategories(categoryId: number, options?: {\r\n recursive?: boolean;\r\n includeCurrent?: boolean;\r\n maxDepth?: number;\r\n }) {\r\n return this.products.getSubCategories(categoryId, options);\r\n }\r\n\r\n /**\r\n * 15. 便捷方法:获取税费信息\r\n */\r\n async getTaxInfo() {\r\n return this.products.getTaxInfo();\r\n }\r\n\r\n /**\r\n * 16. 便捷方法:获取运费信息\r\n */\r\n async getShippingInfo() {\r\n return this.products.getShippingInfo();\r\n }\r\n\r\n /**\r\n * 17. 便捷方法:获取区域信息\r\n */\r\n async getRegions() {\r\n return this.products.getRegions();\r\n }\r\n}\r\n\r\n// 导出所有类型和模块\r\nexport * from './core/types';\r\nexport * from './core/client';\r\nexport * from './modules/articles';\r\nexport * from './modules/products';\r\n\r\n// 默认导出\r\nexport default GT6SDK; "],"names":[],"mappings":"AAycA;AACM,MAAO,QAAS,SAAQ,KAAK,CAAA;IACjC,WAAA,CACE,OAAe,EACR,UAAmB,EAAA;QAE1B,KAAK,CAAC,OAAO,CAAC;QAFP,IAAA,CAAA,UAAU,GAAV,UAAU;AAGjB,QAAA,IAAI,CAAC,IAAI,GAAG,UAAU;;AAEzB;;MChdY,SAAS,CAAA;AAIpB,IAAA,WAAA,CAAY,MAAiB,EAAA;QAC3B,IAAI,CAAC,MAAM,GAAG;AACZ,YAAA,OAAO,EAAE,KAAK;AACd,YAAA,KAAK,EAAE;AACL,gBAAA,OAAO,EAAE,IAAI;gBACb,GAAG,EAAE,MAAM;AACZ,aAAA;AACD,YAAA,GAAG;SACJ;AACD,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE;;AAGxB;;AAEG;AACH,IAAA,MAAM,OAAO,CAAI,QAAgB,EAAE,UAAuB,EAAE,EAAA;QAC1D,MAAM,GAAG,GAAG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