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