chenjunhao 2 週間 前
コミット
46964015a8

+ 9 - 1
spiders/yaoshibang/ysb_snapshot_crawl.py

@@ -666,6 +666,14 @@ class YaoShiBangSnapshot:
         if not shop_name:
         if not shop_name:
             shop_name = item.get("abbreviation", "")
             shop_name = item.get("abbreviation", "")
 
 
+        # 销量: 优先 order_amount > orderAmountPlus > alreadysales
+        sales = (
+            item.get("order_amount")
+            or item.get("orderAmountPlus")
+            or item.get("alreadysales")
+            or ""
+        )
+
         product = {
         product = {
             "platform": self.platform,
             "platform": self.platform,
             "item_id": item_id,
             "item_id": item_id,
@@ -685,7 +693,7 @@ class YaoShiBangSnapshot:
             "factory_name": item.get("manufacturer", ""),
             "factory_name": item.get("manufacturer", ""),
             "scrape_date": time.strftime("%Y-%m-%d"),
             "scrape_date": time.strftime("%Y-%m-%d"),
             "price": price,
             "price": price,
-            "sales": "",
+            "sales": sales,
             "stock_count": item.get("stockAvailable", ""),
             "stock_count": item.get("stockAvailable", ""),
             "snapshot_url": "",
             "snapshot_url": "",
             "approval_num": "",
             "approval_num": "",

+ 10 - 1
spiders/yaoshibang/ysbang_crawl.py

@@ -266,6 +266,15 @@ class YsbSpider:
             shop_name = item.get("abbreviation", "")
             shop_name = item.get("abbreviation", "")
 
 
         brand = item.get("brand","")
         brand = item.get("brand","")
+
+        # 销量: 优先 order_amount > orderAmountPlus > alreadysales
+        sales = (
+            item.get("order_amount")
+            or item.get("orderAmountPlus")
+            or item.get("alreadysales")
+            or ""
+        )
+
         product = {
         product = {
             "platform": self.platform,
             "platform": self.platform,
             "item_id": item_id,
             "item_id": item_id,
@@ -285,7 +294,7 @@ class YsbSpider:
             "factory_name": item.get("manufacturer", ""),
             "factory_name": item.get("manufacturer", ""),
             "scrape_date": time.strftime("%Y-%m-%d"),
             "scrape_date": time.strftime("%Y-%m-%d"),
             "price": price,
             "price": price,
-            "sales": "",
+            "sales": sales,
             "stock_count": item.get("stockAvailable", ""),
             "stock_count": item.get("stockAvailable", ""),
             "snapshot_url": "",
             "snapshot_url": "",
             "approval_num": self.approval_num,
             "approval_num": self.approval_num,