Quellcode durchsuchen

feat(ThirdParty): 添加商品池导入状态标识功能

- 在 ProductService 中增加 importStatus 字段判断逻辑
- 查询 alibaba_import_goods 表检查商品是否已加入商品池
- 根据查询结果设置 importStatus 为 0 或 1
- 将 importStatus 字段添加到返回的商品数据中
- 实现了商品导入状态的实时显示功能
shichen vor 3 Monaten
Ursprung
Commit
83a653e1b8
1 geänderte Dateien mit 7 neuen und 0 gelöschten Zeilen
  1. 7 0
      app/services/ThirdParty/AlibabaAgent/ProductService.php

+ 7 - 0
app/services/ThirdParty/AlibabaAgent/ProductService.php

@@ -110,6 +110,12 @@ class ProductService extends AlibabaAgentBaseService
110 110
             }
111 111
         }
112 112
 
113
+        // 判断是否加入商品池
114
+        $product['importStatus'] = 0;
115
+        $import = Db::name('alibaba_import_goods')->where('product_id', $product['productId'])->find();
116
+        if ($import) {
117
+            $product['importStatus'] = 1;
118
+        }
113 119
         return [
114 120
             'productId'        => $product['itemId'] ?? $product['productId'] ?? $product['offerId'] ?? $product['id'] ?? 0,
115 121
             'productType'      => $product['productType'] ?? '',
@@ -135,6 +141,7 @@ class ProductService extends AlibabaAgentBaseService
135 141
             'shopName'         => $product['shopName'] ?? $product['companyName'] ?? '',
136 142
             'shopId'           => $product['shopId'] ?? $product['memberId'] ?? '',
137 143
             'detailUrl'        => $product['detailUrl'] ?? $product['offerUrl'] ?? '',
144
+            'importStatus'     => $product['importStatus'],
138 145
         ];
139 146
     }
140 147