sc-common-interface 2.5.4__tar.gz → 2.5.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.5.4
3
+ Version: 2.5.5
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -1496,21 +1496,38 @@ def get_sales_keyword(data):
1496
1496
 
1497
1497
  def get_stock_product_set(res,type="stock"):
1498
1498
  list_data = res["data"]["list"]
1499
- for i in list_data:
1500
- combinationList = i["combinationList"]
1501
- for combination in combinationList:
1502
- products = combination["products"]
1503
- for product in products:
1504
- count = product["count"]
1505
- quantity = product["quantity"]
1506
- if quantity==-1:
1507
- # print("库存无限数量")
1508
- pass
1509
- elif quantity<count:
1510
- break
1511
- keyword = combination["keywords"][0]
1512
- product_id = i["id"]
1513
- return keyword, product_id, list_data
1499
+ if type=="stock":
1500
+ for i in list_data:
1501
+ combinationList = i["combinationList"]
1502
+ for combination in combinationList:
1503
+ products = combination["products"]
1504
+ for product in products:
1505
+ count = product["count"]
1506
+ quantity = product["quantity"]
1507
+ if quantity==-1:
1508
+ # print("库存无限数量")
1509
+ pass
1510
+ elif quantity<count:
1511
+ break
1512
+ keyword = combination["keywords"][0]
1513
+ product_id = i["id"]
1514
+ return keyword, product_id, list_data
1515
+ elif type=="out":
1516
+ for i in list_data:
1517
+ combinationList = i["combinationList"]
1518
+ for combination in combinationList:
1519
+ products = combination["products"]
1520
+ for product in products:
1521
+ count = product["count"]
1522
+ quantity = product["quantity"]
1523
+ if quantity != -1 and quantity < count:
1524
+ keyword = combination["keywords"][0]
1525
+ product_id = i["id"]
1526
+ return keyword, product_id, list_data
1527
+
1528
+
1529
+
1530
+
1514
1531
 
1515
1532
  if __name__=="__main__":
1516
1533
  data = {
@@ -1553,7 +1570,7 @@ if __name__=="__main__":
1553
1570
  "skuId": "673c311f52b9d659d30bf878",
1554
1571
  "count": 2,
1555
1572
  "name": "inbox自定义商品",
1556
- "quantity": 1,
1573
+ "quantity": -1,
1557
1574
  "unlimitedQuantity": True
1558
1575
  },
1559
1576
  {
@@ -1561,7 +1578,7 @@ if __name__=="__main__":
1561
1578
  "skuId": "673c2e5a3dc982185de87b57",
1562
1579
  "count": 2,
1563
1580
  "name": "自定义商品哈哈哈",
1564
- "quantity": -1,
1581
+ "quantity": 9999,
1565
1582
  "unlimitedQuantity": True
1566
1583
  }
1567
1584
  ],
@@ -1622,7 +1639,7 @@ if __name__=="__main__":
1622
1639
  {
1623
1640
  "spuId": "670f84314149e400117b3c6a",
1624
1641
  "skuId": "670f84314bd7dd001035d0ea",
1625
- "count": 1,
1642
+ "count": 51,
1626
1643
  "name": "多规格商品名称1729070129(红)",
1627
1644
  "quantity": 50,
1628
1645
  "unlimitedQuantity": True
@@ -1811,5 +1828,5 @@ if __name__=="__main__":
1811
1828
  },
1812
1829
  "traceId": "13f3a0b22dc91017817f0f74756031cf"
1813
1830
  }
1814
- keyword,spuid,__ = get_stock_product_set(data)
1831
+ keyword,spuid,__ = get_stock_product_set(data,"out")
1815
1832
  print(keyword)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sc-common-interface
3
- Version: 2.5.4
3
+ Version: 2.5.5
4
4
  Summary: SC贴文销售公用的接口
5
5
  Home-page: UNKNOWN
6
6
  Author: river
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='sc-common-interface',
5
- version='2.5.4',
5
+ version='2.5.5',
6
6
  description='SC贴文销售公用的接口',
7
7
  author='river',
8
8
  packages=find_packages(),