Просмотр исходного кода

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

- 在 ProductService 中增加 importStatus 字段判断逻辑
- 查询 alibaba_import_goods 表检查商品是否已加入商品池
- 根据查询结果设置 importStatus 为 0 或 1
- 将 importStatus 字段添加到返回的商品数据中
- 实现了商品导入状态的实时显示功能
shichen месяцев назад: 3
Родитель
Сommit
83a653e1b8
1 измененных файлов с 7 добавлено и 0 удалено
  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
         return [
119
         return [
114
             'productId'        => $product['itemId'] ?? $product['productId'] ?? $product['offerId'] ?? $product['id'] ?? 0,
120
             'productId'        => $product['itemId'] ?? $product['productId'] ?? $product['offerId'] ?? $product['id'] ?? 0,
115
             'productType'      => $product['productType'] ?? '',
121
             'productType'      => $product['productType'] ?? '',
@@ -135,6 +141,7 @@ class ProductService extends AlibabaAgentBaseService
135
             'shopName'         => $product['shopName'] ?? $product['companyName'] ?? '',
141
             'shopName'         => $product['shopName'] ?? $product['companyName'] ?? '',
136
             'shopId'           => $product['shopId'] ?? $product['memberId'] ?? '',
142
             'shopId'           => $product['shopId'] ?? $product['memberId'] ?? '',
137
             'detailUrl'        => $product['detailUrl'] ?? $product['offerUrl'] ?? '',
143
             'detailUrl'        => $product['detailUrl'] ?? $product['offerUrl'] ?? '',
144
+            'importStatus'     => $product['importStatus'],
138
         ];
145
         ];
139
     }
146
     }
140
 
147