@gt6/sdk 1.0.34 → 1.0.36

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.
@@ -749,11 +749,11 @@ class ProductsAPI {
749
749
  async getProduct_all(productId) {
750
750
  const product = await this.client.request(`/products_all/${productId}.json`);
751
751
  // 检查产品是否有销售区域和税费模板
752
- if (product.regions && product.regions.length > 0 &&
752
+ if (product.regions_Parent && product.regions_Parent.length > 0 &&
753
753
  product.taxTemplates && product.taxTemplates.length > 0) {
754
754
  try {
755
755
  // 获取税费信息
756
- const taxInfo = await this.getTaxInfo();
756
+ const taxInfo = await this.getTaxInfo01(product.platformId);
757
757
  // 为每个税费模板添加规则
758
758
  product.taxTemplates = product.taxTemplates.map(template => {
759
759
  const matchingTemplate = taxInfo.templates.find(t => t.templateId === template.templateId);
@@ -775,17 +775,17 @@ class ProductsAPI {
775
775
  }
776
776
  }
777
777
  // 检查产品是否有销售区域和运费模板
778
- if (product.regions && product.regions.length > 0 &&
778
+ if (product.regions_Parent && product.regions_Parent.length > 0 &&
779
779
  product.shippingTemplates && product.shippingTemplates.length > 0) {
780
780
  try {
781
781
  // 获取运费信息
782
- const shippingInfo = await this.getShippingInfo();
782
+ const shippingInfo = await this.getShippingInfo01(product.platformId);
783
783
  // 为每个运费模板添加规则
784
784
  product.shippingTemplates = product.shippingTemplates.map(template => {
785
785
  const matchingTemplate = shippingInfo.templates.find(t => t.templateId === template.templateId);
786
786
  if (matchingTemplate) {
787
787
  // 过滤出产品可销售区域的规则
788
- const productRegionIds = product.regions.map(r => r.regionId);
788
+ const productRegionIds = product.regions_Parent.map(r => r.regionId);
789
789
  const applicableRules = matchingTemplate.rules.filter(rule => productRegionIds.includes(rule.regionId));
790
790
  return {
791
791
  ...template,
@@ -1414,6 +1414,9 @@ class ProductsAPI {
1414
1414
  const config = this.client.getConfig();
1415
1415
  return this.client.request(`/tax/platform-${config.platformId}.json`);
1416
1416
  }
1417
+ async getTaxInfo01(platformId) {
1418
+ return this.client.request(`/tax/platform-${platformId}.json`);
1419
+ }
1417
1420
  /**
1418
1421
  * 9. 获取运费信息
1419
1422
  * 获取平台的所有运费模板和规则
@@ -1422,6 +1425,9 @@ class ProductsAPI {
1422
1425
  const config = this.client.getConfig();
1423
1426
  return this.client.request(`/shipping/platform-${config.platformId}.json`);
1424
1427
  }
1428
+ async getShippingInfo01(platformId) {
1429
+ return this.client.request(`/shipping/platform-${platformId}.json`);
1430
+ }
1425
1431
  /**
1426
1432
  * 10. 获取区域信息
1427
1433
  * 获取平台的所有区域信息,包括层级结构